1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
4: # $Id: lonmenu.pm,v 1.186 2006/06/27 18:16:03 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' => 'Course Groups',
67: 'gdoc' => 'Group Documents',
68: 'teams' => 'Teams',
69: );
70: }
71:
72: # ============================= This gets called at the top of the body section
73:
74: sub menubuttons {
75: my $forcereg=shift;
76: my $registration=shift;
77: my $titletable=shift;
78: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
79: ['inhibitmenu']);
80: if (($env{'form.inhibitmenu'} eq 'yes') ||
81: ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
82:
83: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
84:
85: my %lt=&initlittle();
86: my $navmaps='';
87: my $reloadlink='';
88: my $docs='';
89: my $groups='';
90: my $showgroups=0;
91: my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
92: my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
93:
94: if ($env{'request.state'} eq 'construct') {
95: if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
96: my $returnurl = $env{'request.filename'};
97: $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
98: $escurl = &escape($returnurl);
99: }
100: }
101: if ($env{'request.course.id'}) {
102: my %coursegroups;
103: my $viewgrps_permission =
104: &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
105: if (!$viewgrps_permission) {
106: %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'});
107: }
108: if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
109: $showgroups = 1;
110: }
111: }
112:
113: if ($env{'browser.interface'} eq 'textual') {
114: # Textual display only
115: if ($env{'request.course.id'}) {
116: $navmaps=(<<ENDNAV);
117: <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a>
118: ENDNAV
119: if (($env{'request.noversionuri'}=~/^\/adm\//) &&
120: ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
121: ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
122: my $escreload=&escape('return:');
123: $reloadlink=(<<ENDRELOAD);
124: <a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>
125: ENDRELOAD
126: }
127: if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
128: $docs=(<<ENDDOCS);
129: <a href="/adm/coursedocs" target="_top">$lt{'docs'}</a>
130: ENDDOCS
131: }
132: if ($showgroups) {
133: $groups =(<<ENDGROUPS);
134: <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>
135: ENDGROUPS
136: }
137: }
138: my $form=&serverform();
139: my $utility=&utilityfunctions();
140: my $output=(<<ENDMAINMENU);
141: <script type="text/javascript">
142: // BEGIN LON-CAPA Internal
143: $utility
144: </script>
145: <div id="LC_top_nav">
146: <a href="/adm/menu" target="_top">$lt{'main'}</a>
147: $reloadlink $navmaps $docs $groups
148: <a href="/adm/roles" target="_top">$lt{'roles'}</a>
149: <a href="/adm/logout" target="_top">$lt{'exit'}</a>
150: </div>
151: <br />
152: <script type="text/javascript">
153: // END LON-CAPA Internal
154: </script>
155: $form
156: ENDMAINMENU
157: if ($registration) { $output.=&innerregister($forcereg); }
158: return $output."<hr />";
159: } elsif ($env{'environment.remote'} eq 'off') {
160: # Remote Control is switched off
161: # figure out colors
162: my %lt=&initlittle();
163:
164: my $domain=&Apache::loncommon::determinedomain();
165: my $function =&Apache::loncommon::get_users_function();
166: my $link=&Apache::loncommon::designparm($function.'.link',$domain);
167: my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
168: my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
169: my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
170: if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
171: my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
172: return (<<ENDINLINEMENU);
173: <table id="LC_top_nav">
174: <tr>
175: <td>
176: <a href="/adm/logout" target="_top">$lt{'exit'}</a>
177: </td>
178: <td "LC_top_nav_logo">
179: <img align="right" src="$logo" alt="Logo" />
180: <b>LON-CAPA</b>
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: my $text = ($is_group) ? $lt{'groups'} : $lt{'teams'};
206: $groups =(<<ENDGROUPS);
207: <td><a href="/adm/coursegroups" target="_top">$text</a></td>
208: ENDGROUPS
209: }
210: if (
211: ($env{'request.noversionuri'}=~m[^/(res|public)/] &&
212: $env{'request.symb'} eq '')
213: ||
214: (($env{'request.noversionuri'}=~/^\/adm\//) &&
215: ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
216: ($env{'request.noversionuri'}!~
217: m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
218: )
219: ) {
220: my $escreload=&escape('return:');
221: $reloadlink=(<<ENDRELOAD);
222: <td><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></td>
223: ENDRELOAD
224: }
225: }
226: if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
227: my $escreload=&escape('return:');
228: $reloadlink=(<<ENDCRELOAD);
229: <td><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></td>
230: ENDCRELOAD
231: }
232: my $reg='';
233: if ($registration) {
234: $reg=&innerregister($forcereg,$titletable);
235: }
236: my $form=&serverform();
237: my $utility=&utilityfunctions();
238: my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
239: my $remote;
240: if ($env{'user.adv'}) {
241: $remote = '<td><a href="/adm/remote?action=launch&url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'
242: }
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: <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>
253: $reloadlink
254: $navmaps
255: $docs
256: $groups
257: $remote
258: <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>
259: <td><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>
260: <td class="LC_top_nav_logo"><img align="right" src="$logo" alt="Logo" /><b>LON-CAPA</b></td>
261: </tr>
262: </table>
263: $form
264: <script type="text/javascript">
265: // END LON-CAPA Internal
266: </script>
267: $reg
268: ENDINLINEMENU
269: } else {
270: return '';
271: }
272: }
273:
274: # ====================================== This gets called in the header section
275:
276: sub registerurl {
277: my ($forcereg) = @_;
278: my $result = '';
279: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
280: my $force_title='';
281: if ($env{'request.state'} eq 'construct') {
282: $force_title=&Apache::lonxml::display_title();
283: }
284: if (($env{'browser.interface'} eq 'textual') ||
285: ($env{'environment.remote'} eq 'off') ||
286: ((($env{'request.publicaccess'}) ||
287: (!&Apache::lonnet::is_on_map(
288: &unescape($env{'request.noversionuri'})))) &&
289: (!$forcereg))) {
290: return $result.
291: '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title;
292: }
293: # Graphical display after login only
294: if ($env{'request.registered'} && !$forcereg) { return ''; }
295: $result.=&innerregister($forcereg);
296: return $result.$force_title;
297: }
298:
299: # =========== This gets called in order to register a URL, both with the Remote
300: # =========== and in the body of the document
301:
302: sub innerregister {
303: my ($forcereg, $titletable) = @_;
304: my $result = '';
305: my ($uname,$thisdisfn);
306: my $const_space = ($env{'request.state'} eq 'construct');
307: my $is_const_dir = 0;
308:
309: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
310:
311: $env{'request.registered'} = 1;
312:
313: my $textinter=($env{'browser.interface'} eq 'textual');
314: my $noremote=($env{'environment.remote'} eq 'off');
315:
316: my $textual=($textinter || $noremote);
317:
318: undef(@inlineremote);
319:
320: my $reopen=&Apache::lonmenu::reopenmenu();
321:
322: my $newmail='';
323: if ($noremote) {
324: $newmail='<table id="LC_nav_location"><tr>';
325: }
326: if (&Apache::lonmsg::newmail()) {
327: if ($textual) {
328: $newmail.= '<td class="LC_new_mail">
329: <a href="/adm/communicate" target="_top">'.
330: &mt('You have new messages').'</a></td>';
331: } else {
332: $newmail= 'swmenu.setstatus("you have","messages");';
333: }
334: } elsif (($textual)
335: && ($env{'request.symb'})
336: && ($env{'request.course.id'})) {
337: $newmail.= '<td class="LC_current_location">';
338: my ($mapurl,$rid,$resurl)=
339: &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
340: $newmail.=$env{'course.'.$env{'request.course.id'}.'.description'};
341: my $maptitle=&Apache::lonnet::gettitle($mapurl);
342: my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());
343: if ($maptitle && $maptitle ne 'default.sequence') {
344: $newmail.=', '.$maptitle;
345: }
346: if ($restitle) {
347: $newmail.=': '.$restitle;
348: }
349: $newmail.=' </td>';
350: }
351: if ($env{'request.state'} eq 'construct') {
352: $newmail = $titletable;
353: } else {
354: if ($noremote) {
355: $newmail.='</tr></table>';
356: }
357: }
358: my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
359: my $tablestart=($noremote?'<table id="LC_menubuttons">':'').
360: ($textinter?'<br /><a href="#content">'.&mt('Skip to Content').'</a><br />':'');
361: my $tableend=($noremote?'</table>':'').($textinter?'<a name="content" />':'');
362: # =============================================================================
363: # ============================ This is for URLs that actually can be registered
364: if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
365: # -- This applies to homework problems for users with grading privileges
366: my $crs='/'.$env{'request.course.id'};
367: if ($env{'request.course.sec'}) {
368: $crs.='_'.$env{'request.course.sec'};
369: }
370: $crs=~s/\_/\//g;
371:
372: my $hwkadd='';
373: if ($env{'request.symb'} ne '' &&
374: $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
375: if (&Apache::lonnet::allowed('mgr',$crs)) {
376: $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_3]',
377: "gocmd('/adm/grades','gradingmenu')",
378: 'Modify user grades for this assessment resource');
379: } elsif (&Apache::lonnet::allowed('vgr',$crs)) {
380: $hwkadd.=&switch('','',7,2,'subm.gif','view sub-[_1]','missions[_1]',
381: "gocmd('/adm/grades','submission')",
382: 'View user submissions for this assessment resource');
383: }
384: }
385: if ($env{'request.symb'} ne '' &&
386: &Apache::lonnet::allowed('opa',$crs)) {
387: $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
388: "gocmd('/adm/parmset','set')",
389: 'Modify deadlines, etc, for this resource');
390: }
391: # -- End Homework
392: ###
393: ### Determine whether or not to display the 'cstr' button for this
394: ### resource
395: ###
396: my $editbutton = '';
397: if ($env{'user.author'}) {
398: if ($env{'request.role'}=~/^(ca|au)/) {
399: # Set defaults for authors
400: my ($top,$bottom) = ('con-','struct');
401: my $action = "go('/priv/".$env{'user.name'}."');";
402: my $cadom = $env{'request.role.domain'};
403: my $caname = $env{'user.name'};
404: my $desc = "Enter my resource construction space";
405: # Set defaults for co-authors
406: if ($env{'request.role'} =~ /^ca/) {
407: ($cadom,$caname)=($env{'request.role'}=~/(\w+)\/(\w+)$/);
408: ($top,$bottom) = ('co con-','struct');
409: $action = "go('/priv/".$caname."');";
410: $desc = "Enter construction space as co-author";
411: }
412: # Check that we are on the correct machine
413: my $home = &Apache::lonnet::homeserver($caname,$cadom);
414: my $allowed=0;
415: my @ids=&Apache::lonnet::current_machine_ids();
416: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
417: if (!$allowed) {
418: $editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc);
419: }
420: }
421: ##
422: ## Determine if user can edit url.
423: ##
424: my $cfile='';
425: my $cfuname='';
426: my $cfudom='';
427: if ($env{'request.filename'}) {
428: my $file=&Apache::lonnet::declutter($env{'request.filename'});
429: $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
430: # Check that the user has permission to edit this resource
431: ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
432: if (defined($cfudom)) {
433: my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
434: my $allowed=0;
435: my @ids=&Apache::lonnet::current_machine_ids();
436: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
437: if ($allowed) {
438: $cfile=$file;
439: }
440: }
441: }
442: # Finally, turn the button on or off
443: if ($cfile && !$const_space) {
444: $editbutton=&switch
445: ('','',6,1,'cstr.gif','edit[_1]','resource[_2]',
446: "go('".$cfile."');","Edit this resource");
447: } elsif ($editbutton eq '') {
448: $editbutton=&switch('','',6,1,'port.gif',
449: 'port-[_1]','folio[_1]',
450: "go('/adm/portfolio');",
451: "Enter my portfolio space");
452: }
453: }
454: ###
455: ###
456: # Prepare the rest of the buttons
457: my $menuitems;
458: if ($const_space) {
459: my ($uname,$thisdisfn) =
460: ($env{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
461: my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
462: if ($currdir =~ m-/$-) {
463: $is_const_dir = 1;
464: } else {
465: $currdir =~ s#[^/]+$##;
466: $menuitems=(<<ENDMENUITEMS);
467: s&6&1&list.gif&list[_1]&dir[_1]&golist('$currdir')&List current directory
468: s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version
469: s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource
470: s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource
471: s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document
472: ENDMENUITEMS
473: }
474: } elsif (defined($env{'request.course.id'}) &&
475: $env{'request.symb'} ne '') {
476: $menuitems=(<<ENDMENUITEMS);
477: c&3&1
478: s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1
479: s&2&3&forw.gif&forward[_1]&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&3
480: c&6&3
481: c&8&1
482: c&8&2
483: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
484: s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&1
485: s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&1
486: ENDMENUITEMS
487: unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
488: $menuitems.=(<<ENDREALRES);
489: s&6&3&catalog.gif&catalog[_1]&info[_1]&catalog_info()&Show catalog information
490: s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
491: 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
492: ENDREALRES
493: }
494: }
495: my $buttons='';
496: foreach (split(/\n/,$menuitems)) {
497: my ($command,@rest)=split(/\&/,$_);
498: if ($command eq 's') {
499: $buttons.=&switch('','',@rest);
500: } else {
501: $buttons.=&clear(@rest);
502: }
503: }
504:
505: if ($textual) {
506: my $addremote=0;
507: foreach (@inlineremote) { if ($_ ne '') { $addremote=1; } }
508: my $inlinebuttons='';
509: if ($addremote) {
510: # Registered, textual output
511:
512: if ($env{'browser.interface'} eq 'textual') {
513: $inlinebuttons=
514: join('',map { (defined($_)?$_:'') } @inlineremote);
515: } else {
516: $inlinebuttons=(<<ENDINLINE);
517: <tr><td>$inlineremote[21]</td><td> </td><td>$inlineremote[23]</td></tr>
518: <tr><td>$inlineremote[61]</td><td>$inlineremote[62]</td><td>$inlineremote[63]</td></tr>
519: <tr><td>$inlineremote[71]</td><td>$inlineremote[72]</td><td>$inlineremote[73]</td></tr>
520: <tr><td>$inlineremote[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr>
521: <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>
522: ENDINLINE
523: }
524: }
525: $result =(<<ENDREGTEXT);
526: <script type="text/javascript">
527: // BEGIN LON-CAPA Internal
528: </script>
529: $timesync
530: $newmail
531: $tablestart
532: $inlinebuttons
533: $tableend
534: <script type="text/javascript">
535: // END LON-CAPA Internal
536: </script>
537:
538: ENDREGTEXT
539: # Registered, graphical output
540: } else {
541: my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
542: $requri=&Apache::lonenc::check_encrypt(&unescape($requri));
543: my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
544: my $navstatus=&get_nav_status();
545: my $clearcstr;
546:
547: if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
548: $result = (<<ENDREGTHIS);
549:
550: <script type="text/javascript">
551: // BEGIN LON-CAPA Internal
552: var swmenu=null;
553:
554: function LONCAPAreg() {
555: swmenu=$reopen;
556: swmenu.clearTimeout(swmenu.menucltim);
557: $timesync
558: $newmail
559: $buttons
560: swmenu.currentURL="$requri";
561: swmenu.reloadURL=swmenu.currentURL+window.location.search;
562: swmenu.currentSymb="$cursymb";
563: swmenu.reloadSymb="$cursymb";
564: swmenu.currentStale=0;
565: $navstatus
566: $hwkadd
567: $editbutton
568: }
569:
570: function LONCAPAstale() {
571: swmenu=$reopen
572: swmenu.currentStale=1;
573: if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) {
574: swmenu.switchbutton
575: (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
576: }
577: swmenu.clearbut(7,2);
578: swmenu.clearbut(7,3);
579: swmenu.menucltim=swmenu.setTimeout(
580: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
581: 'clearbut(9,1);clearbut(9,3);clearbut(6,3);$clearcstr',
582: 2000);
583: }
584:
585: // END LON-CAPA Internal
586: </script>
587: ENDREGTHIS
588: }
589: # =============================================================================
590: } else {
591: # ========================================== This can or will not be registered
592: if ($textual) {
593: # Not registered, textual
594: $result= (<<ENDDONOTREGTEXT);
595: ENDDONOTREGTEXT
596: } else {
597: # Not registered, graphical
598: $result = (<<ENDDONOTREGTHIS);
599:
600: <script type="text/javascript">
601: // BEGIN LON-CAPA Internal
602: var swmenu=null;
603:
604: function LONCAPAreg() {
605: swmenu=$reopen
606: $timesync
607: swmenu.currentStale=1;
608: swmenu.clearbut(2,1);
609: swmenu.clearbut(2,3);
610: swmenu.clearbut(8,1);
611: swmenu.clearbut(8,2);
612: swmenu.clearbut(8,3);
613: if (swmenu.currentURL) {
614: swmenu.switchbutton
615: (3,1,'reload.gif','return','location','go(currentURL)');
616: } else {
617: swmenu.clearbut(3,1);
618: }
619: }
620:
621: function LONCAPAstale() {
622: }
623:
624: // END LON-CAPA Internal
625: </script>
626: ENDDONOTREGTHIS
627: }
628: # =============================================================================
629: }
630: return $result;
631: }
632:
633: sub loadevents() {
634: if ($env{'request.state'} eq 'construct' ||
635: $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
636: return 'LONCAPAreg();';
637: }
638:
639: sub unloadevents() {
640: if ($env{'request.state'} eq 'construct' ||
641: $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
642: return 'LONCAPAstale();';
643: }
644:
645: # ============================================================= Start up remote
646:
647: sub startupremote {
648: my ($lowerurl)=@_;
649: if (($env{'browser.interface'} eq 'textual') ||
650: ($env{'environment.remote'} eq 'off')) {
651: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
652: }
653: #
654: # The Remote actually gets launched!
655: #
656: my $configmenu=&rawconfig();
657: my $esclowerurl=&escape($lowerurl);
658: my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
659: return(<<ENDREMOTESTARTUP);
660: <script type="text/javascript">
661: var timestart;
662: function wheelswitch() {
663: if (typeof(document.wheel) != 'undefined') {
664: if (typeof(document.wheel.spin) != 'undefined') {
665: var date=new Date();
666: var waited=Math.round(30-((date.getTime()-timestart)/1000));
667: document.wheel.spin.value=$message;
668: }
669: }
670: if (window.status=='|') {
671: window.status='/';
672: } else {
673: if (window.status=='/') {
674: window.status='-';
675: } else {
676: if (window.status=='-') {
677: window.status='\\\\';
678: } else {
679: if (window.status=='\\\\') { window.status='|'; }
680: }
681: }
682: }
683: }
684:
685: // ---------------------------------------------------------- The wait function
686: var canceltim;
687: function wait() {
688: if ((menuloaded==1) || (tim==1)) {
689: window.status='Done.';
690: if (tim==0) {
691: clearTimeout(canceltim);
692: $configmenu
693: window.location='$lowerurl';
694: } else {
695: window.location='/adm/remote?action=collapse&url=$esclowerurl';
696: }
697: } else {
698: wheelswitch();
699: setTimeout('wait();',200);
700: }
701: }
702:
703: function main() {
704: canceltim=setTimeout('tim=1;',30000);
705: window.status='-';
706: var date=new Date();
707: timestart=date.getTime();
708: wait();
709: }
710:
711: </script>
712: ENDREMOTESTARTUP
713: }
714:
715: sub setflags() {
716: return(<<ENDSETFLAGS);
717: <script type="text/javascript">
718: menuloaded=0;
719: tim=0;
720: </script>
721: ENDSETFLAGS
722: }
723:
724: sub maincall() {
725: if (($env{'browser.interface'} eq 'textual') ||
726: ($env{'environment.remote'} eq 'off')) { return ''; }
727: return(<<ENDMAINCALL);
728: <script type="text/javascript">
729: main();
730: </script>
731: ENDMAINCALL
732: }
733:
734: sub load_remote_msg {
735: my ($lowerurl)=@_;
736:
737: if (($env{'browser.interface'} eq 'textual') ||
738: ($env{'environment.remote'} eq 'off')) { return ''; }
739:
740: my $esclowerurl=&escape($lowerurl);
741: my $link=&mt('<a href="[_1]">Continue</a> on in Inline Menu mode',
742: "/adm/remote?action=collapse&url=$esclowerurl");
743: return(<<ENDREMOTEFORM);
744: <p>
745: <form name="wheel">
746: <input name="spin" type="text" size="60" />
747: </form>
748: </p>
749: <p>$link</p>
750: ENDREMOTEFORM
751: }
752: # ================================================================= Reopen menu
753:
754: sub reopenmenu {
755: if (($env{'browser.interface'} eq 'textual') ||
756: ($env{'environment.remote'} eq 'off')) { return ''; }
757: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
758: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
759: return('window.open('.$nothing.',"'.$menuname.'","",false);');
760: }
761:
762: # =============================================================== Open the menu
763:
764: sub open {
765: my $returnval='';
766: if (($env{'browser.interface'} eq 'textual') ||
767: ($env{'environment.remote'} eq 'off')) {
768: return '<script type="text/javascript">self.name="loncapaclient";</script>';
769: }
770: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
771: unless (shift eq 'unix') {
772: # resizing does not work on linux because of virtual desktop sizes
773: $returnval.=(<<ENDRESIZE);
774: if (window.screen) {
775: self.resizeTo(screen.availWidth-215,screen.availHeight-55);
776: self.moveTo(190,15);
777: }
778: ENDRESIZE
779: }
780: $returnval.=(<<ENDOPEN);
781: window.status='Opening LON-CAPA Remote Control';
782: var menu=window.open("/res/adm/pages/menu.html","$menuname",
783: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
784: self.name='loncapaclient';
785: ENDOPEN
786: return '<script type="text/javascript">'.$returnval.'</script>';
787: }
788:
789:
790: # ================================================================== Raw Config
791:
792: sub clear {
793: my ($row,$col)=@_;
794: unless (($env{'browser.interface'} eq 'textual') ||
795: ($env{'environment.remote'} eq 'off')) {
796: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
797: } else {
798: $inlineremote[10*$row+$col]='';
799: return '';
800: }
801: }
802:
803: # ============================================ Switch a button or create a link
804: # Switch acts on the javascript that is executed when a button is clicked.
805: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
806:
807: sub switch {
808: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;
809: $act=~s/\$uname/$uname/g;
810: $act=~s/\$udom/$udom/g;
811: $top=&mt($top);
812: $bot=&mt($bot);
813: $desc=&mt($desc);
814: $img=&mt($img);
815:
816: unless (($env{'browser.interface'} eq 'textual') ||
817: ($env{'environment.remote'} eq 'off')) {
818: # Remote
819: return "\n".
820: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
821: } elsif ($env{'browser.interface'} eq 'textual') {
822: # Accessibility
823: if ($nobreak==2) { return ''; }
824: my $text=$top.' '.$bot;
825: $text=~s/\s*\-\s*//gs;
826: if ($nobreak) {
827: $inlineremote[10*$row+$col]=
828: '<a href="javascript:'.$act.';">'.$text.'</a>';
829: } else {
830: $inlineremote[10*$row+$col]="\n<br />".
831: $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';
832: }
833: } else {
834: # Inline Remote
835: if ($nobreak==2) { return ''; }
836: my $text=$top.' '.$bot;
837: $text=~s/\s*\-\s*//gs;
838:
839: my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
840: if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
841: my $pic=
842: '<img alt="'.$text.'" src="http://'.$ENV{'HTTP_HOST'}.
843: ':'.$lonhttpdPort.'/res/adm/pages/'.$img.'" align="'.
844: ($nobreak==3?'right':'left').'" />';
845: if ($env{'browser.interface'} eq 'faketextual') {
846: # Accessibility
847: if ($nobreak==3) {
848: $inlineremote[10*$row+$col]="\n".
849: '<td class="LC_menubuttons_text" align="right">'.$text.
850: '</td><td class="LC_menubuttons_img" align="left">'.
851: '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
852: } elsif ($nobreak) {
853: $inlineremote[10*$row+$col]="\n<tr>".
854: '<td class="LC_menubuttons_img" align="left">'.
855: '<a href="javascript:'.$act.';">'.$pic.'</a></td>
856: <td class="LC_menubuttons_text" align="left">'.$text.'</td>';
857: } else {
858: $inlineremote[10*$row+$col]="\n<tr>".
859: '<td class="LC_menubuttons_img" align="left">'.
860: '<a href="javascript:'.$act.';">'.$pic.
861: '</a></td><td class="LC_menubuttons_text" colspan="3">'.
862: $desc.'</td></tr>';
863: }
864: } else {
865: # Inline Menu
866: $inlineremote[10*$row+$col]=
867: '<a href="javascript:'.$act.';">'.$pic.
868: '</a><span class="LC_menubuttons_inline_text">'.$desc.'</span>';
869: }
870: }
871: return '';
872: }
873:
874: sub secondlevel {
875: my $output='';
876: my
877: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
878: if ($prt eq 'any') {
879: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
880: } elsif ($prt=~/^r(\w+)/) {
881: if ($rol eq $1) {
882: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
883: }
884: }
885: return $output;
886: }
887:
888: sub openmenu {
889: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
890: if (($env{'browser.interface'} eq 'textual') ||
891: ($env{'environment.remote'} eq 'off')) { return ''; }
892: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
893: return "window.open(".$nothing.",'".$menuname."');";
894: }
895:
896: sub inlinemenu {
897: @inlineremote=();
898: undef @inlineremote;
899: &rawconfig(1);
900: return join('',map { (defined($_)?$_:'') } @inlineremote);
901: }
902:
903: sub rawconfig {
904: my $textualoverride=shift;
905: my $output='';
906: unless (($env{'browser.interface'} eq 'textual') ||
907: ($env{'environment.remote'} eq 'off')) {
908: $output.=
909: "window.status='Opening Remote Control';var swmenu=".&openmenu().
910: "\nwindow.status='Configuring Remote Control ';";
911: } else {
912: unless ($textualoverride) { return ''; }
913: }
914: my $uname=$env{'user.name'};
915: my $udom=$env{'user.domain'};
916: my $adv=$env{'user.adv'};
917: my $author=$env{'user.author'};
918: my $crs='';
919: if ($env{'request.course.id'}) {
920: $crs='/'.$env{'request.course.id'};
921: if ($env{'request.course.sec'}) {
922: $crs.='_'.$env{'request.course.sec'};
923: }
924: $crs=~s/\_/\//g;
925: }
926: my $pub=($env{'request.state'} eq 'published');
927: my $con=($env{'request.state'} eq 'construct');
928: my $rol=$env{'request.role'};
929: my $requested_domain = $env{'request.role.domain'};
930: foreach my $line (@desklines) {
931: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$line);
932: $prt=~s/\$uname/$uname/g;
933: $prt=~s/\$udom/$udom/g;
934: $prt=~s/\$crs/$crs/g;
935: $prt=~s/\$requested_domain/$requested_domain/g;
936: my $type = &Apache::loncommon::course_type();
937: if ($type eq 'Group') {
938: $desc = &convert_menu_function($desc,$type);
939: }
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(&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: #FIXME this needs to move into mydesktab and the other locations
1269: # the text is generated
1270: sub convert_menu_function {
1271: my ($rolename,$type) = @_;
1272: if ($type eq 'Group') {
1273: $rolename =~ s/student/member/g;
1274: $rolename =~ s/group/team/g;
1275: $rolename =~ s/course/group/g;
1276: $rolename =~ s/Course/Group/g;
1277: }
1278: return $rolename;
1279: }
1280:
1281:
1282: # ================================================================ Main Program
1283:
1284: BEGIN {
1285: if (! defined($readdesk)) {
1286: {
1287: my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
1288: if ( CORE::open( my $config,"<$tabfile") ) {
1289: while (my $configline=<$config>) {
1290: $configline=(split(/\#/,$configline))[0];
1291: $configline=~s/^\s+//;
1292: chomp($configline);
1293: if ($configline) {
1294: push(@desklines,$configline);
1295: }
1296: }
1297: CORE::close($config);
1298: }
1299: }
1300: $readdesk='done';
1301: }
1302: }
1303:
1304: 1;
1305: __END__
1306:
1307:
1308:
1309:
1310:
1311:
1312:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>