Annotation of loncom/interface/lonmenu.pm, revision 1.295
1.1 www 1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
1.295 ! raeburn 4: # $Id: lonmenu.pm,v 1.294 2009/10/20 03:18:14 raeburn Exp $
1.11 albertel 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: #
1.1 www 28: #
1.269 droeschl 29: # There is one parameter controlling the action of this module:
1.48 www 30: #
31: # environment.remote - if this is 'on', the routines controll the remote
1.269 droeschl 32: # control, otherwise they render the main window controls;
1.1 www 33:
1.244 jms 34: =head1 NAME
35:
36: Apache::lonmenu
37:
38: =head1 SYNOPSIS
39:
40: Coordinates the response to clicking an image.
41:
42: This is part of the LearningOnline Network with CAPA project
43: described at http://www.lon-capa.org.
44:
45: =head1 SUBROUTINES
46:
47: =over
48:
49: Little texts
50:
51: =item initlittle()
52:
53: =item menubuttons()
54:
55: This gets called at the top of the body section
56:
57: =item show_return_link()
58:
59: =item registerurl()
60:
61: This gets called in the header section
62:
63: =item innerregister()
64:
65: This gets called in order to register a URL, both with the Remote
66: and in the body of the document
67:
68: =item loadevents()
69:
70: =item unloadevents()
71:
72: =item startupremote()
73:
74: =item setflags()
75:
76: =item maincall()
77:
78: =item load_remote_msg()
79:
80: =item get_menu_name()
81:
82: =item reopenmenu()
83:
84: =item open()
85:
86: Open the menu
87:
88: =item clear()
89:
90: =item switch()
91:
92: Switch a button or create a link
93: Switch acts on the javascript that is executed when a button is clicked.
94: The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
95:
96: =item secondlevel()
97:
98: =item openmenu()
99:
100: =item inlinemenu()
101:
102: =item rawconfig()
103:
104: =item close()
105:
106: =item footer()
107:
108: =item utilityfunctions()
109:
110: =item serverform()
111:
112: =item constspaceform()
113:
114: =item get_nav_status()
115:
116: =item hidden_button_check()
117:
118: =item roles_selector()
119:
120: =item jump_to_role()
121:
122: =back
123:
124: =cut
125:
1.1 www 126: package Apache::lonmenu;
127:
128: use strict;
1.152 albertel 129: use Apache::lonnet;
1.47 matthew 130: use Apache::lonhtmlcommon();
1.115 albertel 131: use Apache::loncommon();
1.127 albertel 132: use Apache::lonenc();
1.88 www 133: use Apache::lonlocal;
1.207 foxr 134: use LONCAPA qw(:DEFAULT :match);
1.282 amueller 135: use HTML::Entities();
1.88 www 136:
1.283 droeschl 137: use vars qw(@desklines %category_names %category_members %category_positions
138: $readdesk @primary_menu @secondary_menu);
1.88 www 139:
1.56 www 140: my @inlineremote;
1.38 www 141:
1.283 droeschl 142: sub prep_menuitem {
1.291 raeburn 143: my ($menuitem) = @_;
144: return '' unless(ref($menuitem) eq 'ARRAY');
1.283 droeschl 145: my $link;
146: if ($$menuitem[1]) { # graphical Link
147: $link = "<img class=\"LC_noBorder\""
1.291 raeburn 148: . " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\""
149: . " alt=\"" . &mt($$menuitem[2]) . "\" />";
1.283 droeschl 150: } else { # textual Link
1.291 raeburn 151: $link = &mt($$menuitem[3]);
152: }
153: return '<li><a href="'.$$menuitem[0].'">'.$link.'</a></li>';
1.283 droeschl 154: }
155:
156: # primary_menu() evaluates @primary_menu and returns XHTML for the menu
157: # that contains following links:
158: # About, Message, Roles, Help, Logout
159: # @primary_menu is filled within the BEGIN block of this module with
160: # entries from mydesk.tab
161: sub primary_menu {
162: my $menu;
163: # each element of @primary contains following array:
164: # (link url, icon path, alt text, link text, condition)
165: foreach my $menuitem (@primary_menu) {
166: # evaluate conditions
167: next if $$menuitem[4] eq 'nonewmsg' # show links depending on
1.291 raeburn 168: && &Apache::lonmsg::mynewmail(); # whether a new msg
1.283 droeschl 169: next if $$menuitem[4] eq 'newmsg' # arrived or not
1.291 raeburn 170: && !&Apache::lonmsg::mynewmail(); #
1.283 droeschl 171: next if $$menuitem[4] !~ /public/ ##we've a public user,
172: && $env{'user.name'} eq 'public' ##who should not see all
173: && $env{'user.domain'} eq 'public'; ##links
174: next if $$menuitem[4] eq 'onlypublic'# hide links which are
175: && $env{'user.name'} ne 'public' # only visible to public
176: && $env{'user.domain'} ne 'public'; # users
177: next if $$menuitem[4] eq 'roles' ##show links depending on
1.291 raeburn 178: && &Apache::loncommon::show_course(); ##term 'Courses' or
1.283 droeschl 179: next if $$menuitem[4] eq 'courses' ##'Roles' wanted
1.291 raeburn 180: && !&Apache::loncommon::show_course(); ##
181:
182:
1.283 droeschl 183: if ($$menuitem[3] eq 'Help') { # special treatment for helplink
1.291 raeburn 184: $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
1.283 droeschl 185: } else {
1.291 raeburn 186: if (ref($menuitem) eq 'ARRAY') {
187: my @items = @{$menuitem};
1.292 raeburn 188: $items[0] = 'javascript:'.$menuitem->[0].';';
1.291 raeburn 189: $menu .= &prep_menuitem(\@items);
190: }
1.283 droeschl 191: }
1.291 raeburn 192: }
1.283 droeschl 193:
1.291 raeburn 194: return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";
1.283 droeschl 195: }
196:
197:
198: sub secondary_menu {
199: my $menu;
200:
1.286 raeburn 201: my $crstype = &Apache::loncommon::course_type();
202: my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
203: my $canviewgrps = &Apache::lonnet::allowed('vcg', $env{'request.course.id'}
204: . ($env{'request.course.sec'} ? "/$env{'request.course.sec'}"
205: : ''));
206: my $showlink = &show_return_link();
207: my %groups = &Apache::lonnet::get_active_groups(
208: $env{'user.domain'}, $env{'user.name'},
209: $env{'course.' . $env{'request.course.id'} . '.domain'},
210: $env{'course.' . $env{'request.course.id'} . '.num'});
1.283 droeschl 211: foreach my $menuitem (@secondary_menu) {
212: # evaluate conditions
213: next if $$menuitem[4] ne 'always'
214: && !$env{'request.course.id'};
215: next if $$menuitem[4] eq 'showreturn'
1.286 raeburn 216: && !$showlink
1.283 droeschl 217: && !($env{'request.state'} eq 'construct');
218: next if $$menuitem[4] =~ /^mdc/
1.286 raeburn 219: && !$canedit;
220: next if $$menuitem[4] eq 'mdcCourse'
221: && $crstype eq 'Community';
222: next if $$menuitem[4] eq 'mdcCommunity'
223: && $crstype ne 'Community';
224: next if $$menuitem[4] =~ /^remotenav/
1.283 droeschl 225: && $env{'environment.remotenavmap'} ne 'on';
1.286 raeburn 226: next if $$menuitem[4] =~ /noremotenav/
1.283 droeschl 227: && $env{'environment.remotenavmap'} eq 'on';
1.295 ! raeburn 228: next if $$menuitem[4] =~ /^(no|)remotenav$/
! 229: && $crstype eq 'Community';
! 230: next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/
! 231: && $crstype ne 'Community';
1.283 droeschl 232: next if $$menuitem[4] =~ /showgroups$/
1.286 raeburn 233: && $canviewgrps
234: && !%groups;
1.283 droeschl 235:
1.286 raeburn 236: if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
1.283 droeschl 237: # special treatment for role selector
238: my $roles_selector = roles_selector(
239: $env{'course.' . $env{'request.course.id'} . '.domain'},
240: $env{'course.' . $env{'request.course.id'} . '.num'} );
241:
242: $menu .= $roles_selector ? "<li>$roles_selector</li>"
243: : '';
244: } else {
1.291 raeburn 245: if ($env{'environment.remotenavmap'} eq 'on') {
246: my @items = @{$menuitem};
247: if ($menuitem->[4] eq 'remotenav') {
248: $items[0] = "javascript:gonav('$menuitem->[0]');";
249: } else {
250: $items[0] = "javascript:go('$menuitem->[0]');";
251: }
252: $menu .= &prep_menuitem(\@items);
253: } else {
254: $menu .= &prep_menuitem(\@$menuitem);
255: }
1.283 droeschl 256: }
257: }
258: if ($menu =~ /\[url\].*\[symb\]/) {
1.291 raeburn 259: my $escurl = &escape( &Apache::lonenc::check_encrypt(
260: $env{'request.noversionuri'}));
1.283 droeschl 261:
1.291 raeburn 262: my $escsymb = &escape( &Apache::lonenc::check_encrypt(
263: $env{'request.symb'}));
1.283 droeschl 264:
265: if ( $env{'request.state'} eq 'construct'
266: and ( $env{'request.noversionuri'} eq ''
267: || !defined($env{'request.noversionuri'})))
268: {
269: ($escurl = $env{'request.filename'}) =~
270: s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2};
271:
1.291 raeburn 272: $escurl = &escape($escurl);
1.283 droeschl 273: }
274: $menu =~ s/\[url\]/$escurl/g;
275: $menu =~ s/\[symb\]/$escsymb/g;
276: }
277:
1.285 wenzelju 278: return "<ul id=\"LC_secondary_menu\">$menu</ul>";
1.283 droeschl 279: }
280:
281:
1.274 www 282: #
283: # This routine returns a translated hash for the menu items in the top inline menu row
284: # Probably should be in mydesk.tab
285:
1.283 droeschl 286: #SD this sub is deprecated - don't use it
1.88 www 287: sub initlittle {
288: return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
1.281 raeburn 289: 'nav' => 'Course Contents',
1.88 www 290: 'main' => 'Main Menu',
1.266 raeburn 291: 'roles' => (&Apache::loncommon::show_course()?
1.231 albertel 292: 'Courses':'Roles'),
1.235 raeburn 293: 'other' => 'Other Roles',
1.219 albertel 294: 'docs' => 'Edit Course',
1.257 hauer 295: 'exit' => 'Logout',
1.202 albertel 296: 'login' => 'Log In',
1.165 raeburn 297: 'launch' => 'Launch Remote Control',
1.188 albertel 298: 'groups' => 'Groups',
1.286 raeburn 299: 'gdoc' => 'Community Documents',
1.184 raeburn 300: );
1.88 www 301: }
302:
1.283 droeschl 303: #SD this sub is deprecated - don't use it
304: #SD functionality is covered by new loncommon::bodytag and primary_menu(), secondary_menu()
1.38 www 305: sub menubuttons {
306: my $forcereg=shift;
1.131 raeburn 307: my $titletable=shift;
1.274 www 308: #
309: # Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes"
310: #
1.112 albertel 311: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
312: ['inhibitmenu']);
1.152 albertel 313: if (($env{'form.inhibitmenu'} eq 'yes') ||
1.149 www 314: ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
1.175 albertel 315:
316: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
317:
1.163 www 318: my %lt=&initlittle();
1.55 www 319: my $navmaps='';
1.59 www 320: my $reloadlink='';
1.151 www 321: my $docs='';
1.165 raeburn 322: my $groups='';
1.235 raeburn 323: my $roles='<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';
324: my $role_selector;
1.165 raeburn 325: my $showgroups=0;
1.235 raeburn 326: my ($cnum,$cdom);
1.274 www 327: #
328: # if the URL is hidden, symbs and the non-versioned version of the URL would be encrypted
329: #
1.183 www 330: my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
331: my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
1.176 albertel 332:
1.199 albertel 333: my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
1.253 kaisler 334: $logo = '<a href="/adm/about.html"><img src="'.
335: $logo.'" alt="LON-CAPA Logo" class="LC_noBorder" /></a>';
1.199 albertel 336:
1.152 albertel 337: if ($env{'request.state'} eq 'construct') {
1.274 www 338: #
339: # We are in construction space
340: #
1.152 albertel 341: if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
342: my $returnurl = $env{'request.filename'};
1.134 raeburn 343: $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
1.183 www 344: $escurl = &escape($returnurl);
1.134 raeburn 345: }
346: }
1.165 raeburn 347: if ($env{'request.course.id'}) {
1.274 www 348: #
349: # We are in a course
350: #
1.235 raeburn 351: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
352: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
1.165 raeburn 353: my %coursegroups;
1.188 albertel 354: my $viewgrps_permission =
1.197 raeburn 355: &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
1.165 raeburn 356: if (!$viewgrps_permission) {
1.235 raeburn 357: %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$cdom,$cnum);
1.188 albertel 358: }
1.165 raeburn 359: if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
360: $showgroups = 1;
361: }
1.235 raeburn 362: $role_selector = &roles_selector($cdom,$cnum);
363: if ($role_selector) {
364: $roles = '<span class="LC_nobreak">'.$role_selector.' <a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></span>';
365: }
1.165 raeburn 366: }
367:
1.267 droeschl 368: if ($env{'environment.remote'} eq 'off') {
1.48 www 369: # Remote Control is switched off
1.58 www 370: # figure out colors
1.267 droeschl 371: my %lt=&initlittle();
1.172 albertel 372:
1.58 www 373: my $domain=&Apache::loncommon::determinedomain();
1.291 raeburn 374: my $function=&Apache::loncommon::get_users_function();
1.58 www 375: my $link=&Apache::loncommon::designparm($function.'.link',$domain);
376: my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
377: my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
378: my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
1.267 droeschl 379:
380: if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
381: return (<<ENDINLINEMENU);
1.285 wenzelju 382: <ol class="LC_primary_menu LC_right">
1.271 droeschl 383: <li>$logo</li>
384: <li><a href="/adm/roles" target="_top">$lt{'login'}</a></li>
385: </ol>
386: <hr />
1.156 albertel 387: ENDINLINEMENU
388: }
1.253 kaisler 389: $roles = '<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';
1.58 www 390: # Do we have a NAV link?
1.152 albertel 391: if ($env{'request.course.id'}) {
1.141 albertel 392: my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='.
393: $escsymb;
1.152 albertel 394: if ($env{'environment.remotenavmap'} eq 'on') {
1.141 albertel 395: $link="javascript:gonav('".$link."')";
396: }
397: $navmaps=(<<ENDNAV);
1.253 kaisler 398: <li><a href="$link" target="_top">$lt{'nav'}</a></li>
1.114 albertel 399: ENDNAV
1.286 raeburn 400: my $is_community =
401: (&Apache::loncommon::course_type() eq 'Community');
1.152 albertel 402: if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
1.286 raeburn 403: my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'};
1.151 www 404: $docs=(<<ENDDOCS);
1.253 kaisler 405: <li><a href="/adm/coursedocs" target="_top">$text</a></li>
1.151 www 406: ENDDOCS
407: }
1.197 raeburn 408: if ($showgroups) {
409: $groups =(<<ENDGROUPS);
1.253 kaisler 410: <li><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></li>
1.197 raeburn 411: ENDGROUPS
412: }
1.228 albertel 413: if (&show_return_link()) {
1.183 www 414: my $escreload=&escape('return:');
1.59 www 415: $reloadlink=(<<ENDRELOAD);
1.253 kaisler 416: <li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>
1.59 www 417: ENDRELOAD
418: }
1.235 raeburn 419: if ($role_selector) {
1.253 kaisler 420: #$roles = '<td>'.$role_selector.'</td><td><a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></td>';
421: $role_selector = '<li>'.$role_selector.'</li>';
1.235 raeburn 422: }
1.55 www 423: }
1.163 www 424: if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
1.183 www 425: my $escreload=&escape('return:');
1.163 www 426: $reloadlink=(<<ENDCRELOAD);
1.253 kaisler 427: <li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>
1.163 www 428: ENDCRELOAD
429: }
1.276 droeschl 430: my $reg = $forcereg ? &innerregister($forcereg,$titletable) : '';
431: my $form = &serverform();
432: my $utility = &utilityfunctions();
433:
434: #Prepare the message link that indicates the arrival of new mail
1.291 raeburn 435: my $messagelink = &Apache::lonmsg::mynewmail() ? "Message (new)" : "Message";
1.276 droeschl 436: $messagelink = '<a href="javascript:go(\'/adm/communicate\');">'
437: . mt($messagelink) .'</a>';
438:
439: my $helplink = &Apache::loncommon::top_nav_help('Help');
1.58 www 440: return (<<ENDINLINEMENU);
1.129 albertel 441: <script type="text/javascript">
1.277 bisitz 442: // <![CDATA[
1.150 albertel 443: // BEGIN LON-CAPA Internal
1.116 albertel 444: $utility
1.150 albertel 445: // ]]>
1.48 www 446: </script>
1.285 wenzelju 447: <ol class="LC_primary_menu LC_right">
1.253 kaisler 448: <li>$logo</li>
1.256 kaisler 449: <li>$messagelink</li>
1.253 kaisler 450: <li>$roles</li>
451: <li>$helplink</li>
452: <li><a href="/adm/logout" target="_top">$lt{'exit'}</a></li>
453: </ol>
1.285 wenzelju 454: <ul id="LC_secondary_menu">
1.253 kaisler 455: <li><a href="/adm/menu" target="_top">$lt{'main'}</a></li>
1.59 www 456: $reloadlink
1.55 www 457: $navmaps
1.151 www 458: $docs
1.165 raeburn 459: $groups
1.253 kaisler 460: $role_selector
1.263 droeschl 461: </ul>
1.168 albertel 462: $form
1.129 albertel 463: <script type="text/javascript">
1.48 www 464: // END LON-CAPA Internal
465: </script>
1.58 www 466: $reg
1.48 www 467: ENDINLINEMENU
468: } else {
469: return '';
470: }
1.72 www 471: }
472:
1.228 albertel 473: sub show_return_link {
474: return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
475: $env{'request.symb'} eq '')
476: ||
477: ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl})
478: ||
479: (($env{'request.noversionuri'}=~/^\/adm\//) &&
480: ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
481: ($env{'request.noversionuri'}!~
482: m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
483: ));
484: }
485:
1.38 www 486:
487: sub registerurl {
1.173 albertel 488: my ($forcereg) = @_;
1.38 www 489: my $result = '';
1.175 albertel 490: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.66 albertel 491: my $force_title='';
1.152 albertel 492: if ($env{'request.state'} eq 'construct') {
1.66 albertel 493: $force_title=&Apache::lonxml::display_title();
494: }
1.269 droeschl 495: if (($env{'environment.remote'} eq 'off') ||
1.152 albertel 496: ((($env{'request.publicaccess'}) ||
1.83 www 497: (!&Apache::lonnet::is_on_map(
1.183 www 498: &unescape($env{'request.noversionuri'})))) &&
1.38 www 499: (!$forcereg))) {
1.277 bisitz 500: return
501: $result
502: .'<script type="text/javascript">'."\n"
503: .'// <![CDATA['."\n"
504: .'function LONCAPAreg(){;} function LONCAPAstale(){}'."\n"
505: .'// ]]>'."\n"
506: .'</script>'
507: .$force_title;
1.38 www 508: }
1.41 www 509: # Graphical display after login only
1.174 albertel 510: if ($env{'request.registered'} && !$forcereg) { return ''; }
1.173 albertel 511: $result.=&innerregister($forcereg);
1.66 albertel 512: return $result.$force_title;
1.40 www 513: }
514:
515: sub innerregister {
1.173 albertel 516: my ($forcereg, $titletable) = @_;
1.40 www 517: my $result = '';
1.120 raeburn 518: my ($uname,$thisdisfn);
1.152 albertel 519: my $const_space = ($env{'request.state'} eq 'construct');
1.131 raeburn 520: my $is_const_dir = 0;
1.120 raeburn 521:
1.175 albertel 522: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.40 www 523:
1.174 albertel 524: $env{'request.registered'} = 1;
1.40 www 525:
1.267 droeschl 526: my $noremote = ($env{'environment.remote'} eq 'off');
1.49 www 527:
1.177 albertel 528: undef(@inlineremote);
1.56 www 529:
1.38 www 530: my $reopen=&Apache::lonmenu::reopenmenu();
1.40 www 531:
1.38 www 532: my $newmail='';
1.267 droeschl 533:
534: if (&Apache::lonmsg::newmail() && !$noremote) {
535: # We have new mail and remote is up
536: $newmail= 'swmenu.setstatus("you have","messages");';
1.233 www 537: }
1.276 droeschl 538:
1.288 raeburn 539: my ($breadcrumb,$separator);
1.267 droeschl 540: if ($noremote
1.177 albertel 541: && ($env{'request.symb'})
542: && ($env{'request.course.id'})) {
1.267 droeschl 543:
544: my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
545: my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
546:
547: my $maptitle = &Apache::lonnet::gettitle($mapurl);
548: my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
1.289 raeburn 549: my @crumbs = ({text => "Course Contents",
550: href => "Javascript:gonav('/adm/navmaps')"});
551:
552: if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
553: push(@crumbs, {text => '...',
554: no_mt => 1});
555: }
1.268 droeschl 556:
557: push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle
558: && $maptitle ne 'default.sequence'
559: && $maptitle ne $coursetitle);
560:
561: push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
562:
1.291 raeburn 563: &Apache::lonhtmlcommon::clear_breadcrumbs();
564: &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
565: $breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
1.288 raeburn 566: unless (($env{'request.state'} eq 'edit') || ($newmail) ||
567: ($env{'request.state'} eq 'construct') ||
568: ($env{'form.register'})) {
569: $separator = &Apache::loncommon::head_subbox();
570: }
1.267 droeschl 571: #
1.65 www 572: }
1.152 albertel 573: if ($env{'request.state'} eq 'construct') {
1.131 raeburn 574: $newmail = $titletable;
1.267 droeschl 575: }
576: my $timesync = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' );
577: my $tablestart = ( $noremote ? '<table id="LC_menubuttons">' : '');
578: my $tableend = ( $noremote ? '</table>' : '');
1.41 www 579: # =============================================================================
580: # ============================ This is for URLs that actually can be registered
1.152 albertel 581: if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
1.40 www 582: # -- This applies to homework problems for users with grading privileges
1.152 albertel 583: my $crs='/'.$env{'request.course.id'};
584: if ($env{'request.course.sec'}) {
585: $crs.='_'.$env{'request.course.sec'};
1.107 albertel 586: }
587: $crs=~s/\_/\//g;
588:
1.38 www 589: my $hwkadd='';
1.152 albertel 590: if ($env{'request.symb'} ne '' &&
1.161 albertel 591: $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
1.79 www 592: if (&Apache::lonnet::allowed('mgr',$crs)) {
1.259 bisitz 593: $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_4]',
1.40 www 594: "gocmd('/adm/grades','gradingmenu')",
595: 'Modify user grades for this assessment resource');
1.154 www 596: } elsif (&Apache::lonnet::allowed('vgr',$crs)) {
597: $hwkadd.=&switch('','',7,2,'subm.gif','view sub-[_1]','missions[_1]',
598: "gocmd('/adm/grades','submission')",
599: 'View user submissions for this assessment resource');
1.38 www 600: }
1.107 albertel 601: }
1.152 albertel 602: if ($env{'request.symb'} ne '' &&
1.145 albertel 603: &Apache::lonnet::allowed('opa',$crs)) {
1.107 albertel 604: $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
605: "gocmd('/adm/parmset','set')",
1.196 www 606: 'Modify parameter settings for this resource');
1.38 www 607: }
1.40 www 608: # -- End Homework
1.38 www 609: ###
610: ### Determine whether or not to display the 'cstr' button for this
611: ### resource
612: ###
613: my $editbutton = '';
1.258 raeburn 614: my $noeditbutton = 1;
615: my ($cnum,$cdom);
616: if ($env{'request.course.id'}) {
617: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
618: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
619: }
1.152 albertel 620: if ($env{'user.author'}) {
1.234 raeburn 621: if ($env{'request.role'}=~/^(aa|ca|au)/) {
1.274 www 622: #
623: # We have the role of an author
624: #
1.38 www 625: # Set defaults for authors
626: my ($top,$bottom) = ('con-','struct');
1.152 albertel 627: my $action = "go('/priv/".$env{'user.name'}."');";
628: my $cadom = $env{'request.role.domain'};
629: my $caname = $env{'user.name'};
1.236 bisitz 630: my $desc = "Enter my construction space";
1.38 www 631: # Set defaults for co-authors
1.152 albertel 632: if ($env{'request.role'} =~ /^ca/) {
1.206 albertel 633: ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
1.38 www 634: ($top,$bottom) = ('co con-','struct');
635: $action = "go('/priv/".$caname."');";
636: $desc = "Enter construction space as co-author";
1.234 raeburn 637: } elsif ($env{'request.role'} =~ /^aa/) {
638: ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
639: ($top,$bottom) = ('co con-','struct');
640: $action = "go('/priv/".$caname."');";
641: $desc = "Enter construction space as assistant co-author";
1.38 www 642: }
643: # Check that we are on the correct machine
644: my $home = &Apache::lonnet::homeserver($caname,$cadom);
1.109 albertel 645: my $allowed=0;
646: my @ids=&Apache::lonnet::current_machine_ids();
647: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
648: if (!$allowed) {
649: $editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc);
1.258 raeburn 650: $noeditbutton = 0;
1.38 www 651: }
652: }
1.274 www 653: #
654: # We are an author for some stuff, but currently do not have the role of author.
655: # Figure out if we have authoring privileges for the resource we are looking at.
656: # This should maybe become a privilege check in lonnet
657: #
1.38 www 658: ##
659: ## Determine if user can edit url.
660: ##
661: my $cfile='';
662: my $cfuname='';
663: my $cfudom='';
1.258 raeburn 664: my $uploaded;
1.152 albertel 665: if ($env{'request.filename'}) {
666: my $file=&Apache::lonnet::declutter($env{'request.filename'});
1.258 raeburn 667: if (defined($cnum) && defined($cdom)) {
668: $uploaded = &is_course_upload($file,$cnum,$cdom);
669: }
670: if (!$uploaded) {
671: $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
672: # Check that the user has permission to edit this resource
673: ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
674: if (defined($cfudom)) {
675: my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
676: my $allowed=0;
677: my @ids=&Apache::lonnet::current_machine_ids();
678: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
679: if ($allowed) {
680: $cfile=$file;
681: }
1.38 www 682: }
683: }
1.258 raeburn 684: }
1.38 www 685: # Finally, turn the button on or off
1.120 raeburn 686: if ($cfile && !$const_space) {
1.40 www 687: $editbutton=&switch
1.212 www 688: ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
1.38 www 689: "go('".$cfile."');","Edit this resource");
1.258 raeburn 690: $noeditbutton = 0;
1.38 www 691: } elsif ($editbutton eq '') {
1.191 www 692: $editbutton=&clear(6,1);
1.38 www 693: }
694: }
1.258 raeburn 695: if (($noeditbutton) && ($env{'request.filename'})) {
696: if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
697: my $file=&Apache::lonnet::declutter($env{'request.filename'});
698: if (defined($cnum) && defined($cdom)) {
699: if (&is_course_upload($file,$cnum,$cdom)) {
700: my $cfile = &edit_course_upload($file,$cnum,$cdom);
701: if ($cfile) {
702: $editbutton=&switch
703: ('','',6,1,'pcstr.gif','edit[_1]',
704: 'resource[_2]',"go('".$cfile."');",
705: 'Edit this resource');
706: }
707: }
708: }
709: }
710: }
1.38 www 711: ###
712: ###
1.41 www 713: # Prepare the rest of the buttons
1.120 raeburn 714: my $menuitems;
715: if ($const_space) {
1.274 www 716: #
717: # We are in construction space
718: #
1.128 albertel 719: my ($uname,$thisdisfn) =
1.152 albertel 720: ($env{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
1.121 raeburn 721: my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
1.131 raeburn 722: if ($currdir =~ m-/$-) {
723: $is_const_dir = 1;
724: } else {
1.267 droeschl 725: $currdir =~ s|[^/]+$||;
1.200 foxr 726: my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
1.208 albertel 727: my $esc_currdir = &Apache::loncommon::escape_single($currdir);
1.274 www 728: #
729: # Probably should be in mydesk.tab
730: #
1.131 raeburn 731: $menuitems=(<<ENDMENUITEMS);
1.208 albertel 732: s&6&1&list.gif&list[_1]&dir[_1]&golist('$esc_currdir')&List current directory
1.200 foxr 733: s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$cleandisfn')&Retrieve old version
1.259 bisitz 734: s&6&3&pub.gif&publish[_1]&resource[_3]&gocstr('/adm/publish','/~$uname/$cleandisfn')&Publish this resource
1.200 foxr 735: s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$cleandisfn')&Delete this resource
736: s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document
1.120 raeburn 737: ENDMENUITEMS
1.131 raeburn 738: }
1.203 foxr 739: } elsif ( defined($env{'request.course.id'}) &&
740: $env{'request.symb'} ne '' ) {
1.274 www 741: #
742: # We are in a course and looking at a registred URL
743: # Should probably be in mydesk.tab
744: #
1.120 raeburn 745: $menuitems=(<<ENDMENUITEMS);
1.41 www 746: c&3&1
1.209 www 747: s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&&1
748: s&2&3&forw.gif&forward[_1]&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&&3
1.77 www 749: c&6&3
750: c&8&1
751: c&8&2
1.106 www 752: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
1.209 www 753: s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
1.41 www 754: ENDMENUITEMS
1.216 albertel 755:
1.243 tempelho 756: my $currentURL = &Apache::loncommon::get_symb();
757: my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
758: my $annotation = &Apache::loncommon::get_annotation($symb_old,$symb_old_enc);
759: $menuitems.="s&9&3&";
760: if(length($annotation) > 0){
761: $menuitems.="anot2.gif";
762: }else{
763: $menuitems.="anot.gif";
764: }
765: $menuitems.="&anno-[_1]&tations[_1]&annotate()&";
766: $menuitems.="Make notes and annotations about this resource&&1\n";
767:
1.279 raeburn 768: unless ($noremote) {
769: my $showreqcrs = &check_for_rcrs();
770: if ($showreqcrs) {
771: $menuitems.="s&8&1&rcrs.gif&request[_1]&course[_16]".
772: "&go('/adm/requestcourse')&Course requests\n";
773: }
774: }
1.193 raeburn 775: unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
1.294 raeburn 776: if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
1.216 albertel 777: $menuitems.=(<<ENDREALRES);
1.259 bisitz 778: s&6&3&catalog.gif&catalog[_2]&info[_1]&catalog_info()&Show Metadata
1.216 albertel 779: ENDREALRES
780: }
1.120 raeburn 781: $menuitems.=(<<ENDREALRES);
1.106 www 782: s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
783: 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
1.77 www 784: ENDREALRES
1.120 raeburn 785: }
786: }
1.203 foxr 787: if ($env{'request.uri'} =~ /^\/res/) {
788: $menuitems .= (<<ENDMENUITEMS);
789: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
790: ENDMENUITEMS
791: }
1.41 www 792: my $buttons='';
793: foreach (split(/\n/,$menuitems)) {
794: my ($command,@rest)=split(/\&/,$_);
1.220 raeburn 795: my $idx=10*$rest[0]+$rest[1];
796: if (&hidden_button_check() eq 'yes') {
797: if ($idx == 21 ||$idx == 23) {
798: $buttons.=&switch('','',@rest);
799: } else {
800: $buttons.=&clear(@rest);
801: }
802: } else {
803: if ($command eq 's') {
804: $buttons.=&switch('','',@rest);
805: } else {
806: $buttons.=&clear(@rest);
807: }
1.41 www 808: }
809: }
1.148 albertel 810:
1.267 droeschl 811: if ($noremote) {
1.148 albertel 812: my $addremote=0;
1.267 droeschl 813: foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
1.148 albertel 814: my $inlinebuttons='';
815: if ($addremote) {
1.267 droeschl 816: # Registered, textual output
1.218 www 817: if ($env{'environment.icons'} eq 'iconsonly') {
1.220 raeburn 818: $inlinebuttons=(<<ENDARROWSINLINE);
1.218 www 819: <tr><td>
820: $inlineremote[21] $inlineremote[23]
1.220 raeburn 821: ENDARROWSINLINE
822: if (&hidden_button_check() ne 'yes') {
823: $inlinebuttons .= (<<ENDINLINEICONS);
1.218 www 824: $inlineremote[61] $inlineremote[63]
825: $inlineremote[71] $inlineremote[72] $inlineremote[73]
826: $inlineremote[81] $inlineremote[82] $inlineremote[83]
827: $inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>
828: ENDINLINEICONS
1.220 raeburn 829: }
1.218 www 830: } else {
1.223 albertel 831: if ($inlineremote[21] ne '' || $inlineremote[23] ne '') {
832: $inlinebuttons=(<<ENDFIRSTLINE);
1.129 albertel 833: <tr><td>$inlineremote[21]</td><td> </td><td>$inlineremote[23]</td></tr>
1.220 raeburn 834: ENDFIRSTLINE
1.223 albertel 835: }
1.220 raeburn 836: if (&hidden_button_check() ne 'yes') {
1.223 albertel 837: foreach my $row (6..9) {
838: if ($inlineremote[${row}.'1'] ne ''
839: || $inlineremote[$row.'2'] ne ''
840: || $inlineremote[$row.'3'] ne '') {
841: $inlinebuttons .= <<"ENDLINE";
842: <tr><td>$inlineremote["${row}1"]</td><td>$inlineremote["${row}2"]</td><td>$inlineremote["${row}3"]</td></tr>
843: ENDLINE
844: }
845: }
846: }
847: }
1.103 www 848: }
1.41 www 849: $result =(<<ENDREGTEXT);
1.129 albertel 850: <script type="text/javascript">
1.42 www 851: // BEGIN LON-CAPA Internal
852: </script>
1.41 www 853: $timesync
1.267 droeschl 854: $breadcrumb
1.58 www 855: $tablestart
1.56 www 856: $inlinebuttons
1.227 albertel 857: $tableend
1.224 albertel 858: $newmail
1.288 raeburn 859: $separator
1.129 albertel 860: <script type="text/javascript">
1.64 www 861: // END LON-CAPA Internal
1.42 www 862: </script>
863:
1.41 www 864: ENDREGTEXT
865: # Registered, graphical output
866: } else {
1.152 albertel 867: my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1.183 www 868: $requri=&Apache::lonenc::check_encrypt(&unescape($requri));
1.152 albertel 869: my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1.113 albertel 870: my $navstatus=&get_nav_status();
1.140 albertel 871: my $clearcstr;
1.148 albertel 872:
1.152 albertel 873: if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
1.41 www 874: $result = (<<ENDREGTHIS);
1.38 www 875:
1.129 albertel 876: <script type="text/javascript">
1.277 bisitz 877: // <![CDATA[
1.150 albertel 878: // BEGIN LON-CAPA Internal
1.42 www 879: var swmenu=null;
1.38 www 880:
881: function LONCAPAreg() {
882: swmenu=$reopen;
883: swmenu.clearTimeout(swmenu.menucltim);
884: $timesync
885: $newmail
1.41 www 886: $buttons
1.84 www 887: swmenu.currentURL="$requri";
1.85 www 888: swmenu.reloadURL=swmenu.currentURL+window.location.search;
1.125 albertel 889: swmenu.currentSymb="$cursymb";
890: swmenu.reloadSymb="$cursymb";
1.38 www 891: swmenu.currentStale=0;
1.113 albertel 892: $navstatus
1.38 www 893: $hwkadd
894: $editbutton
895: }
896:
897: function LONCAPAstale() {
898: swmenu=$reopen
899: swmenu.currentStale=1;
900: if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) {
901: swmenu.switchbutton
902: (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
903: }
904: swmenu.clearbut(7,2);
905: swmenu.clearbut(7,3);
906: swmenu.menucltim=swmenu.setTimeout(
907: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
1.140 albertel 908: 'clearbut(9,1);clearbut(9,3);clearbut(6,3);$clearcstr',
1.38 www 909: 2000);
910: }
911:
1.150 albertel 912: // END LON-CAPA Internal
1.277 bisitz 913: // ]]>
1.38 www 914: </script>
915: ENDREGTHIS
1.41 www 916: }
917: # =============================================================================
1.38 www 918: } else {
1.41 www 919: # ========================================== This can or will not be registered
1.267 droeschl 920: if ($noremote) {
1.269 droeschl 921: # Not registered
1.267 droeschl 922: $result= (<<ENDDONOTREGTEXT);
1.41 www 923: ENDDONOTREGTEXT
924: } else {
925: # Not registered, graphical
926: $result = (<<ENDDONOTREGTHIS);
1.38 www 927:
1.129 albertel 928: <script type="text/javascript">
1.277 bisitz 929: // <![CDATA[
1.38 www 930: // BEGIN LON-CAPA Internal
1.42 www 931: var swmenu=null;
1.38 www 932:
933: function LONCAPAreg() {
934: swmenu=$reopen
935: $timesync
936: swmenu.currentStale=1;
937: swmenu.clearbut(2,1);
938: swmenu.clearbut(2,3);
939: swmenu.clearbut(8,1);
940: swmenu.clearbut(8,2);
941: swmenu.clearbut(8,3);
942: if (swmenu.currentURL) {
943: swmenu.switchbutton
944: (3,1,'reload.gif','return','location','go(currentURL)');
945: } else {
946: swmenu.clearbut(3,1);
947: }
948: }
949:
950: function LONCAPAstale() {
951: }
952:
953: // END LON-CAPA Internal
1.277 bisitz 954: // ]]>
1.38 www 955: </script>
956: ENDDONOTREGTHIS
1.41 www 957: }
958: # =============================================================================
1.38 www 959: }
960: return $result;
961: }
962:
1.258 raeburn 963: sub is_course_upload {
964: my ($file,$cnum,$cdom) = @_;
965: my $uploadpath = &LONCAPA::propath($cdom,$cnum);
966: $uploadpath =~ s{^\/}{};
967: if (($file =~ m{^\Q$uploadpath\E/userfiles/docs/}) ||
968: ($file =~ m{^userfiles/\Q$cdom\E/\Q$cnum\E/docs/})) {
969: return 1;
970: }
971: return;
972: }
973:
974: sub edit_course_upload {
975: my ($file,$cnum,$cdom) = @_;
976: my $cfile;
977: if ($file =~/\.(htm|html|css|js|txt)$/) {
978: my $ext = $1;
979: my $url = &Apache::lonnet::hreflocation('',$file);
980: my $home = &Apache::lonnet::homeserver($cnum,$cdom);
981: my @ids=&Apache::lonnet::current_machine_ids();
982: my $dest;
983: if ($home && grep(/^\Q$home\E$/,@ids)) {
984: $dest = $url.'?forceedit=1';
985: } else {
986: unless (&Apache::lonnet::get_locks()) {
987: $dest = '/adm/switchserver?otherserver='.
988: $home.'&role='.$env{'request.role'}.
989: '&url='.$url.'&forceedit=1';
990: }
991: }
992: if ($dest) {
993: $cfile = &HTML::Entities::encode($dest,'"<>&');
994: }
995: }
996: return $cfile;
997: }
998:
1.38 www 999: sub loadevents() {
1.152 albertel 1000: if ($env{'request.state'} eq 'construct' ||
1.175 albertel 1001: $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.38 www 1002: return 'LONCAPAreg();';
1003: }
1004:
1005: sub unloadevents() {
1.152 albertel 1006: if ($env{'request.state'} eq 'construct' ||
1.175 albertel 1007: $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.38 www 1008: return 'LONCAPAstale();';
1009: }
1.30 www 1010:
1.32 www 1011:
1012: sub startupremote {
1013: my ($lowerurl)=@_;
1.269 droeschl 1014: if ($env{'environment.remote'} eq 'off') {
1.34 www 1015: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
1016: }
1.49 www 1017: #
1018: # The Remote actually gets launched!
1019: #
1.32 www 1020: my $configmenu=&rawconfig();
1.183 www 1021: my $esclowerurl=&escape($lowerurl);
1.119 www 1022: my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
1.32 www 1023: return(<<ENDREMOTESTARTUP);
1.129 albertel 1024: <script type="text/javascript">
1.277 bisitz 1025: // <![CDATA[
1.118 albertel 1026: var timestart;
1.35 www 1027: function wheelswitch() {
1.118 albertel 1028: if (typeof(document.wheel) != 'undefined') {
1029: if (typeof(document.wheel.spin) != 'undefined') {
1030: var date=new Date();
1031: var waited=Math.round(30-((date.getTime()-timestart)/1000));
1032: document.wheel.spin.value=$message;
1033: }
1034: }
1.35 www 1035: if (window.status=='|') {
1036: window.status='/';
1037: } else {
1038: if (window.status=='/') {
1039: window.status='-';
1040: } else {
1041: if (window.status=='-') {
1042: window.status='\\\\';
1043: } else {
1044: if (window.status=='\\\\') { window.status='|'; }
1045: }
1046: }
1047: }
1048: }
1049:
1.32 www 1050: // ---------------------------------------------------------- The wait function
1051: var canceltim;
1052: function wait() {
1053: if ((menuloaded==1) || (tim==1)) {
1.35 www 1054: window.status='Done.';
1.32 www 1055: if (tim==0) {
1056: clearTimeout(canceltim);
1057: $configmenu
1058: window.location='$lowerurl';
1059: } else {
1.52 www 1060: window.location='/adm/remote?action=collapse&url=$esclowerurl';
1.32 www 1061: }
1062: } else {
1.35 www 1063: wheelswitch();
1064: setTimeout('wait();',200);
1.32 www 1065: }
1066: }
1067:
1068: function main() {
1.52 www 1069: canceltim=setTimeout('tim=1;',30000);
1.35 www 1070: window.status='-';
1.118 albertel 1071: var date=new Date();
1072: timestart=date.getTime();
1.32 www 1073: wait();
1074: }
1075:
1.277 bisitz 1076: // ]]>
1.32 www 1077: </script>
1078: ENDREMOTESTARTUP
1079: }
1080:
1081: sub setflags() {
1082: return(<<ENDSETFLAGS);
1.129 albertel 1083: <script type="text/javascript">
1.277 bisitz 1084: // <![CDATA[
1.32 www 1085: menuloaded=0;
1086: tim=0;
1.277 bisitz 1087: // ]]>
1.32 www 1088: </script>
1089: ENDSETFLAGS
1090: }
1091:
1092: sub maincall() {
1.269 droeschl 1093: if ($env{'environment.remote'} eq 'off') { return ''; }
1.32 www 1094: return(<<ENDMAINCALL);
1.129 albertel 1095: <script type="text/javascript">
1.277 bisitz 1096: // <![CDATA[
1.32 www 1097: main();
1.277 bisitz 1098: // ]]>
1.32 www 1099: </script>
1100: ENDMAINCALL
1101: }
1.118 albertel 1102:
1103: sub load_remote_msg {
1104: my ($lowerurl)=@_;
1105:
1.269 droeschl 1106: if ($env{'environment.remote'} eq 'off') { return ''; }
1.118 albertel 1107:
1.183 www 1108: my $esclowerurl=&escape($lowerurl);
1.261 bisitz 1109: my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
1110: ,'<a href="/adm/remote?action=collapse&url='.$esclowerurl.'">'
1111: ,'</a>');
1.118 albertel 1112: return(<<ENDREMOTEFORM);
1113: <p>
1114: <form name="wheel">
1.119 www 1115: <input name="spin" type="text" size="60" />
1.118 albertel 1116: </form>
1117: </p>
1118: <p>$link</p>
1119: ENDREMOTEFORM
1120: }
1.230 albertel 1121:
1122: sub get_menu_name {
1123: my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
1124: $hostid =~ s/\W//g;
1125: return 'LCmenu'.$hostid;
1126: }
1127:
1.30 www 1128:
1129: sub reopenmenu {
1.269 droeschl 1130: if ($env{'environment.remote'} eq 'off') { return ''; }
1.230 albertel 1131: my $menuname = &get_menu_name();
1.47 matthew 1132: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
1133: return('window.open('.$nothing.',"'.$menuname.'","",false);');
1.30 www 1134: }
1135:
1.1 www 1136:
1137: sub open {
1.22 www 1138: my $returnval='';
1.269 droeschl 1139: if ($env{'environment.remote'} eq 'off') {
1.277 bisitz 1140: return
1141: '<script type="text/javascript">'."\n"
1142: .'// <![CDATA['."\n"
1143: .'self.name="loncapaclient";'."\n"
1144: .'// ]]>'."\n"
1145: .'</script>';
1.111 albertel 1146: }
1.230 albertel 1147: my $menuname = &get_menu_name();
1.222 albertel 1148:
1149: # unless (shift eq 'unix') {
1.22 www 1150: # resizing does not work on linux because of virtual desktop sizes
1.222 albertel 1151: # $returnval.=(<<ENDRESIZE);
1152: #if (window.screen) {
1153: # self.resizeTo(screen.availWidth-215,screen.availHeight-55);
1154: # self.moveTo(190,15);
1155: #}
1156: #ENDRESIZE
1157: # }
1.277 bisitz 1158: $returnval=(<<ENDOPEN);
1159: // <![CDATA[
1.35 www 1160: window.status='Opening LON-CAPA Remote Control';
1.272 droeschl 1161: var menu=window.open("/res/adm/pages/menu.html?inhibitmenu=yes","$menuname",
1.191 www 1162: "height=375,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
1.71 www 1163: self.name='loncapaclient';
1.277 bisitz 1164: // ]]>
1.1 www 1165: ENDOPEN
1.129 albertel 1166: return '<script type="text/javascript">'.$returnval.'</script>';
1.1 www 1167: }
1168:
1.2 www 1169:
1170: # ================================================================== Raw Config
1171:
1.3 www 1172: sub clear {
1173: my ($row,$col)=@_;
1.269 droeschl 1174: unless ($env{'environment.remote'} eq 'off') {
1.275 www 1175: if (($row<1) || ($row>13)) { return ''; }
1.35 www 1176: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
1.56 www 1177: } else {
1178: $inlineremote[10*$row+$col]='';
1179: return '';
1180: }
1.3 www 1181: }
1182:
1.40 www 1183: # ============================================ Switch a button or create a link
1.25 matthew 1184: # Switch acts on the javascript that is executed when a button is clicked.
1185: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
1.40 www 1186:
1.2 www 1187: sub switch {
1.209 www 1188: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_;
1.2 www 1189: $act=~s/\$uname/$uname/g;
1190: $act=~s/\$udom/$udom/g;
1.88 www 1191: $top=&mt($top);
1192: $bot=&mt($bot);
1193: $desc=&mt($desc);
1.238 www 1194: if (($env{'environment.remote'} ne 'off') || ($env{'environment.icons'} eq 'classic')) {
1195: $img=&mt($img);
1196: }
1.209 www 1197: my $idx=10*$row+$col;
1198: $category_members{$cat}.=':'.$idx;
1199:
1.269 droeschl 1200: unless ($env{'environment.remote'} eq 'off') {
1.275 www 1201: if (($row<1) || ($row>13)) { return ''; }
1.50 www 1202: # Remote
1.34 www 1203: return "\n".
1.35 www 1204: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
1.34 www 1205: } else {
1.50 www 1206: # Inline Remote
1.213 www 1207: if ($env{'environment.icons'} ne 'classic') {
1208: $img=~s/\.gif$/\.png/;
1209: }
1.41 www 1210: if ($nobreak==2) { return ''; }
1.34 www 1211: my $text=$top.' '.$bot;
1.78 www 1212: $text=~s/\s*\-\s*//gs;
1.105 www 1213:
1.99 www 1214: my $pic=
1.225 albertel 1215: '<img alt="'.$text.'" src="'.
1216: &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
1.250 harmsja 1217: '" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />';
1.177 albertel 1218: if ($env{'browser.interface'} eq 'faketextual') {
1.274 www 1219: # Main Menu
1.103 www 1220: if ($nobreak==3) {
1.209 www 1221: $inlineremote[$idx]="\n".
1.177 albertel 1222: '<td class="LC_menubuttons_text" align="right">'.$text.
1.247 harmsja 1223: '</td><td align="left">'.
1.103 www 1224: '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
1225: } elsif ($nobreak) {
1.209 www 1226: $inlineremote[$idx]="\n<tr>".
1.247 harmsja 1227: '<td align="left">'.
1.177 albertel 1228: '<a href="javascript:'.$act.';">'.$pic.'</a></td>
1.215 www 1229: <td class="LC_menubuttons_text" align="left"><a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$text.'</span></a></td>';
1.103 www 1230: } else {
1.209 www 1231: $inlineremote[$idx]="\n<tr>".
1.247 harmsja 1232: '<td align="left">'.
1.103 www 1233: '<a href="javascript:'.$act.';">'.$pic.
1.177 albertel 1234: '</a></td><td class="LC_menubuttons_text" colspan="3">'.
1.215 www 1235: '<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>';
1.103 www 1236: }
1.94 www 1237: } else {
1.103 www 1238: # Inline Menu
1.218 www 1239: if ($env{'environment.icons'} eq 'iconsonly') {
1240: $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
1241: } else {
1242: $inlineremote[$idx]=
1.215 www 1243: '<a class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
1244: '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
1.218 www 1245: }
1.94 www 1246: }
1.34 www 1247: }
1.56 www 1248: return '';
1.2 www 1249: }
1250:
1251: sub secondlevel {
1252: my $output='';
1253: my
1.209 www 1254: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat)=@_;
1.2 www 1255: if ($prt eq 'any') {
1.209 www 1256: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1257: } elsif ($prt=~/^r(\w+)/) {
1258: if ($rol eq $1) {
1.209 www 1259: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1260: }
1261: }
1262: return $output;
1263: }
1264:
1.18 www 1265: sub openmenu {
1.230 albertel 1266: my $menuname = &get_menu_name();
1.269 droeschl 1267: if ($env{'environment.remote'} eq 'off') { return ''; }
1.47 matthew 1268: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
1269: return "window.open(".$nothing.",'".$menuname."');";
1.18 www 1270: }
1271:
1.56 www 1272: sub inlinemenu {
1.210 albertel 1273: undef(@inlineremote);
1274: undef(%category_members);
1.275 www 1275: # calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
1.56 www 1276: &rawconfig(1);
1.214 albertel 1277: my $output='<table id="LC_mainmenu"><tr>';
1.209 www 1278: for (my $col=1; $col<=2; $col++) {
1.241 riegler 1279: $output.='<td class="LC_mainmenu_col_fieldset">';
1.209 www 1280: for (my $row=1; $row<=8; $row++) {
1281: foreach my $cat (keys(%category_members)) {
1282: if ($category_positions{$cat} ne "$col,$row") { next; }
1.247 harmsja 1283: #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
1.270 bisitz 1284: $output.='<div class="LC_Box">';
1.250 harmsja 1285: $output.='<h4 class="LC_hcell">'.&mt($category_names{$cat}).'</h4>';
1.247 harmsja 1286: $output.='<table>';
1.240 riegler 1287: my %active=();
1288: foreach my $menu_item (split(/\:/,$category_members{$cat})) {
1289: if ($inlineremote[$menu_item]) {
1290: $active{$menu_item}=1;
1291: }
1292: }
1293: foreach my $item (sort(keys(%active))) {
1294: $output.=$inlineremote[$item];
1295: }
1296: $output.='</table>';
1.245 harmsja 1297: $output.='</div>';
1.240 riegler 1298: }
1299: }
1300: $output.="</td>";
1301: }
1302: $output.="</tr></table>";
1303: return $output;
1304: }
1305:
1.2 www 1306: sub rawconfig {
1.274 www 1307: #
1308: # This evaluates mydesk.tab
1309: # Need to add more positions and more privileges to deal with all
1310: # menu items.
1311: #
1.34 www 1312: my $textualoverride=shift;
1313: my $output='';
1.269 droeschl 1314: unless ($env{'environment.remote'} eq 'off') {
1.35 www 1315: $output.=
1316: "window.status='Opening Remote Control';var swmenu=".&openmenu().
1317: "\nwindow.status='Configuring Remote Control ';";
1.34 www 1318: } else {
1319: unless ($textualoverride) { return ''; }
1320: }
1.152 albertel 1321: my $uname=$env{'user.name'};
1322: my $udom=$env{'user.domain'};
1323: my $adv=$env{'user.adv'};
1.266 raeburn 1324: my $show_course=&Apache::loncommon::show_course();
1.152 albertel 1325: my $author=$env{'user.author'};
1.5 www 1326: my $crs='';
1.295 ! raeburn 1327: my $crstype='';
1.152 albertel 1328: if ($env{'request.course.id'}) {
1329: $crs='/'.$env{'request.course.id'};
1330: if ($env{'request.course.sec'}) {
1331: $crs.='_'.$env{'request.course.sec'};
1.7 www 1332: }
1.8 www 1333: $crs=~s/\_/\//g;
1.295 ! raeburn 1334: $crstype = &Apache::loncommon::course_type();
1.5 www 1335: }
1.152 albertel 1336: my $pub=($env{'request.state'} eq 'published');
1337: my $con=($env{'request.state'} eq 'construct');
1338: my $rol=$env{'request.role'};
1339: my $requested_domain = $env{'request.role.domain'};
1.184 raeburn 1340: foreach my $line (@desklines) {
1.209 www 1341: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
1.3 www 1342: $prt=~s/\$uname/$uname/g;
1343: $prt=~s/\$udom/$udom/g;
1.295 ! raeburn 1344: if ($prt =~ /\$crs/) {
! 1345: next unless ($env{'request.course.id'});
! 1346: next if ($crstype eq 'Community');
! 1347: $prt=~s/\$crs/$crs/g;
! 1348: } elsif ($prt =~ /\$cmty/) {
! 1349: next unless ($env{'request.course.id'});
! 1350: next if ($crstype ne 'Community');
! 1351: $prt=~s/\$cmty/$crs/g;
! 1352: }
1.25 matthew 1353: $prt=~s/\$requested_domain/$requested_domain/g;
1.211 www 1354: if ($category_names{$cat}!~/\w/) { $cat='oth'; }
1.3 www 1355: if ($pro eq 'clear') {
1.4 www 1356: $output.=&clear($row,$col);
1.3 www 1357: } elsif ($pro eq 'any') {
1.2 www 1358: $output.=&secondlevel(
1.209 www 1359: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1360: } elsif ($pro eq 'smp') {
1361: unless ($adv) {
1362: $output.=&secondlevel(
1.209 www 1363: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1364: }
1365: } elsif ($pro eq 'adv') {
1366: if ($adv) {
1367: $output.=&secondlevel(
1.209 www 1368: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1369: }
1.231 albertel 1370: } elsif ($pro eq 'shc') {
1371: if ($show_course) {
1372: $output.=&secondlevel(
1373: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1374: }
1375: } elsif ($pro eq 'nsc') {
1376: if (!$show_course) {
1377: $output.=&secondlevel(
1378: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1379: }
1.81 matthew 1380: } elsif (($pro=~/^p(\w+)/) && ($prt)) {
1.295 ! raeburn 1381: my $priv = $1;
! 1382: if ($priv =~ /^mdc(Course|Community)/) {
! 1383: if ($crstype eq $1) {
! 1384: $priv = 'mdc';
! 1385: } else {
! 1386: next;
! 1387: }
! 1388: }
! 1389: if (&Apache::lonnet::allowed($priv,$prt)) {
1.209 www 1390: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.4 www 1391: }
1.295 ! raeburn 1392: } elsif ($pro eq 'course') {
! 1393: if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
1.209 www 1394: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.81 matthew 1395: }
1.295 ! raeburn 1396: } elsif ($pro eq 'community') {
! 1397: if (($env{'request.course.fn'}) && ($crstype eq 'Community')) {
! 1398: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
! 1399: }
1.124 matthew 1400: } elsif ($pro =~ /^courseenv_(.*)$/) {
1401: my $key = $1;
1.295 ! raeburn 1402: if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
! 1403: ($crstype ne 'Community')) {
! 1404: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
! 1405: }
! 1406: } elsif ($pro =~ /^communityenv_(.*)$/) {
! 1407: my $key = $1;
! 1408: if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
! 1409: ($crstype eq 'Community')) {
1.209 www 1410: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.124 matthew 1411: }
1.81 matthew 1412: } elsif ($pro =~ /^course_(.*)$/) {
1413: # Check for permissions inside of a course
1.295 ! raeburn 1414: if (($env{'request.course.id'}) && ($crstype ne 'Community') &&
1.152 albertel 1415: (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
1416: ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
1.81 matthew 1417: )) {
1.209 www 1418: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.26 www 1419: }
1.295 ! raeburn 1420: } elsif ($pro =~ /^community_(.*)$/) {
! 1421: # Check for permissions inside of a community
! 1422: if (($env{'request.course.id'}) && ($crstype eq 'Community') &&
! 1423: (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
! 1424: ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
! 1425: )) {
! 1426: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
! 1427: }
1.4 www 1428: } elsif ($pro eq 'author') {
1429: if ($author) {
1.152 albertel 1430: if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
1.234 raeburn 1431: (($prt eq 'raa') && ($env{'request.role'}=~/^aa/)) ||
1.152 albertel 1432: (($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
1.19 matthew 1433: # Check that we are on the correct machine
1.29 matthew 1434: my $cadom=$requested_domain;
1.152 albertel 1435: my $caname=$env{'user.name'};
1.234 raeburn 1436: if (($prt eq 'rca') || ($prt eq 'raa')) {
1.29 matthew 1437: ($cadom,$caname)=
1.206 albertel 1438: ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
1.29 matthew 1439: }
1440: $act =~ s/\$caname/$caname/g;
1.19 matthew 1441: my $home = &Apache::lonnet::homeserver($caname,$cadom);
1.109 albertel 1442: my $allowed=0;
1443: my @ids=&Apache::lonnet::current_machine_ids();
1444: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
1445: if ($allowed) {
1.209 www 1446: $output.=&switch($caname,$cadom,
1447: $row,$col,$img,$top,$bot,$act,$desc,$cat);
1.19 matthew 1448: }
1.6 www 1449: }
1.2 www 1450: }
1.248 raeburn 1451: } elsif ($pro eq 'tools') {
1452: my @tools = ('aboutme','blog','portfolio');
1453: if (grep(/^\Q$prt\E$/,@tools)) {
1.249 raeburn 1454: if (!&Apache::lonnet::usertools_access($env{'user.name'},
1.251 raeburn 1455: $env{'user.domain'},
1456: $prt,undef,'tools')) {
1457: $output.=&clear($row,$col);
1458: next;
1459: }
1.278 raeburn 1460: } elsif (($prt eq 'reqcrsnsc') || ($prt eq 'reqcrsshc')) {
1461: if (($prt eq 'reqcrsnsc') && ($show_course)) {
1462: next;
1463: }
1464: if (($prt eq 'reqcrsshc') && (!$show_course)) {
1465: next;
1466: }
1.279 raeburn 1467: my $showreqcrs = &check_for_rcrs();
1.251 raeburn 1468: if (!$showreqcrs) {
1.248 raeburn 1469: $output.=&clear($row,$col);
1470: next;
1471: }
1472: }
1473: $prt='any';
1474: $output.=&secondlevel(
1475: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2 www 1476: }
1.13 harris41 1477: }
1.269 droeschl 1478: unless ($env{'environment.remote'} eq 'off') {
1.35 www 1479: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
1.123 www 1480: if (&Apache::lonmsg::newmail()) {
1481: $output.='swmenu.setstatus("you have","messages");';
1482: }
1.34 www 1483: }
1.123 www 1484:
1.2 www 1485: return $output;
1486: }
1487:
1.279 raeburn 1488: sub check_for_rcrs {
1489: my $showreqcrs = 0;
1.280 raeburn 1490: my @reqtypes = ('official','unofficial','community');
1491: foreach my $type (@reqtypes) {
1.279 raeburn 1492: if (&Apache::lonnet::usertools_access($env{'user.name'},
1493: $env{'user.domain'},
1494: $type,undef,'requestcourses')) {
1495: $showreqcrs = 1;
1496: last;
1497: }
1498: }
1.280 raeburn 1499: if (!$showreqcrs) {
1500: foreach my $type (@reqtypes) {
1501: if ($env{'environment.reqcrsotherdom.'.$type} ne '') {
1502: $showreqcrs = 1;
1503: last;
1504: }
1505: }
1506: }
1.279 raeburn 1507: return $showreqcrs;
1508: }
1509:
1.2 www 1510: # ======================================================================= Close
1.1 www 1511:
1512: sub close {
1.269 droeschl 1513: if ($env{'environment.remote'} eq 'off') { return ''; }
1.230 albertel 1514: my $menuname = &get_menu_name();
1.1 www 1515: return(<<ENDCLOSE);
1.129 albertel 1516: <script type="text/javascript">
1.277 bisitz 1517: // <![CDATA[
1.35 www 1518: window.status='Accessing Remote Control';
1.30 www 1519: menu=window.open("/adm/rat/empty.html","$menuname",
1.1 www 1520: "height=350,width=150,scrollbars=no,menubar=no");
1.35 www 1521: window.status='Disabling Remote Control';
1522: menu.active=0;
1.31 www 1523: menu.autologout=0;
1.35 www 1524: window.status='Closing Remote Control';
1.1 www 1525: menu.close();
1.35 www 1526: window.status='Done.';
1.277 bisitz 1527: // ]]>
1.1 www 1528: </script>
1529: ENDCLOSE
1530: }
1531:
1532: # ====================================================================== Footer
1533:
1534: sub footer {
1535:
1.33 www 1536: }
1537:
1.122 albertel 1538: sub nav_control_js {
1.152 albertel 1539: my $nav=($env{'environment.remotenavmap'} eq 'on');
1.122 albertel 1540: return (<<NAVCONTROL);
1541: var w_loncapanav_flag="$nav";
1542:
1543:
1544: function gonav(url) {
1545: if (w_loncapanav_flag != 1) {
1546: gopost(url,'');
1547: } else {
1548: navwindow=window.open(url,
1549: "loncapanav","height=600,width=400,scrollbars=1");
1550: }
1551: }
1552: NAVCONTROL
1553: }
1554:
1.42 www 1555: sub utilityfunctions {
1.132 raeburn 1556: my $caller = shift;
1.269 droeschl 1557: unless ($env{'environment.remote'} eq 'off' ||
1558: $caller eq '/adm/menu') {
1559: return ''; }
1560:
1.152 albertel 1561: my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1.293 raeburn 1562: if ($currenturl =~ m{^/adm/wrapper/ext/}) {
1563: if ($env{'request.external.querystring'}) {
1564: $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
1565: }
1566: }
1.183 www 1567: $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
1.125 albertel 1568:
1.152 albertel 1569: my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1.122 albertel 1570: my $nav_control=&nav_control_js();
1.175 albertel 1571:
1572: my $start_page_annotate =
1573: &Apache::loncommon::start_page('Annotator',undef,
1574: {'only_body' => 1,
1575: 'js_ready' => 1,
1576: 'bgcolor' => '#BBBBBB',
1577: 'add_entries' => {
1578: 'onload' => 'javascript:document.goannotate.submit();'}});
1579:
1.205 albertel 1580: my $end_page_annotate =
1581: &Apache::loncommon::end_page({'js_ready' => 1});
1582:
1.175 albertel 1583: my $start_page_bookmark =
1584: &Apache::loncommon::start_page('Bookmarks',undef,
1585: {'only_body' => 1,
1586: 'js_ready' => 1,
1587: 'bgcolor' => '#BBBBBB',});
1588:
1.205 albertel 1589: my $end_page_bookmark =
1.175 albertel 1590: &Apache::loncommon::end_page({'js_ready' => 1});
1591:
1.42 www 1592: return (<<ENDUTILITY)
1593:
1594: var currentURL="$currenturl";
1595: var reloadURL="$currenturl";
1596: var currentSymb="$currentsymb";
1597:
1.114 albertel 1598: $nav_control
1599:
1.42 www 1600: function go(url) {
1601: if (url!='' && url!= null) {
1602: currentURL = null;
1603: currentSymb= null;
1604: window.location.href=url;
1605: }
1606: }
1607:
1608: function gopost(url,postdata) {
1609: if (url!='') {
1610: this.document.server.action=url;
1611: this.document.server.postdata.value=postdata;
1612: this.document.server.command.value='';
1613: this.document.server.url.value='';
1614: this.document.server.symb.value='';
1615: this.document.server.submit();
1616: }
1617: }
1618:
1619: function gocmd(url,cmd) {
1620: if (url!='') {
1621: this.document.server.action=url;
1622: this.document.server.postdata.value='';
1623: this.document.server.command.value=cmd;
1624: this.document.server.url.value=currentURL;
1625: this.document.server.symb.value=currentSymb;
1626: this.document.server.submit();
1627: }
1.57 www 1628: }
1629:
1.121 raeburn 1630: function gocstr(url,filename) {
1631: if (url == '/adm/cfile?action=delete') {
1632: this.document.cstrdelete.filename.value = filename
1633: this.document.cstrdelete.submit();
1634: return;
1635: }
1.137 raeburn 1636: if (url == '/adm/printout') {
1637: this.document.cstrprint.postdata.value = filename
1638: this.document.cstrprint.curseed.value = 0;
1639: this.document.cstrprint.problemtype.value = 0;
1.138 raeburn 1640: if (this.document.lonhomework) {
1641: if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
1642: this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
1643: }
1644: if (this.document.lonhomework.problemtype) {
1.164 albertel 1645: if (this.document.lonhomework.problemtype.value) {
1646: this.document.cstrprint.problemtype.value =
1647: this.document.lonhomework.problemtype.value;
1648: } else if (this.document.lonhomework.problemtype.options) {
1649: for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
1650: if (this.document.lonhomework.problemtype.options[i].selected) {
1651: if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') {
1652: this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
1653: }
1654: }
1655: }
1656: }
1657: }
1658: }
1.137 raeburn 1659: this.document.cstrprint.submit();
1660: return;
1661: }
1.121 raeburn 1662: if (url !='') {
1663: this.document.constspace.filename.value = filename;
1664: this.document.constspace.action = url;
1665: this.document.constspace.submit();
1666: }
1667: }
1668:
1.131 raeburn 1669: function golist(url) {
1670: if (url!='' && url!= null) {
1671: currentURL = null;
1672: currentSymb= null;
1673: top.location.href=url;
1674: }
1675: }
1676:
1677:
1.121 raeburn 1678:
1.57 www 1679: function catalog_info() {
1.102 albertel 1680: loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
1.57 www 1681: }
1682:
1683: function chat_win() {
1.290 raeburn 1684: lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no');
1.42 www 1685: }
1.169 raeburn 1686:
1687: function group_chat(group) {
1688: var url = '/adm/groupchat?group='+group;
1689: var winName = 'LONchat_'+group;
1690: grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
1691: }
1.175 albertel 1692:
1693: function edit_bookmarks() {
1694: go('');
1695: w_BookmarkPal_flag=1;
1696: bookmarkpal=window.open("/adm/bookmarks",
1697: "BookmarkPal", "width=400,height=505,scrollbars=0");
1698: }
1699:
1700: function annotate() {
1701: w_Annotator_flag=1;
1702: annotator=window.open('','Annotator','width=365,height=265,scrollbars=0');
1703: annotator.document.write(
1704: '$start_page_annotate'
1705: +"<form name='goannotate' target='Annotator' method='post' "
1706: +"action='/adm/annotations'>"
1.217 albertel 1707: +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
1.181 albertel 1708: +"<\\/form>"
1.205 albertel 1709: +'$end_page_annotate');
1.175 albertel 1710: annotator.document.close();
1711: }
1712:
1713: function set_bookmark() {
1714: go('');
1715: clienttitle=document.title;
1716: clienthref=location.pathname;
1717: w_bmquery_flag=1;
1718: bmquery=window.open('','bmquery','width=365,height=165,scrollbars=0');
1719: bmquery.document.write(
1720: '$start_page_bookmark'
1.260 bisitz 1721: +'<center><form method="post"'
1722: +' name="newlink" action="/adm/bookmarks" target="bmquery" '
1723: +'> <table width="340" height="150" '
1724: +'bgcolor="#FFFFFF" align="center"><tr><td>Link Name:<br /><input '
1725: +'type="text" name="title" size="45" value="'+clienttitle+'" />'
1726: +'<br />Address:<br /><input type="text" name="address" size="45" '
1727: +'value="'+clienthref+'" /><br /><center><input type="submit" '
1728: +'value="Save" /> <input type="button" value="Close" '
1729: +'onclick="javascript:window.close();" /></center></td>'
1730: +'</tr></table></form></center>'
1.205 albertel 1731: +'$end_page_bookmark' );
1.175 albertel 1732: bmquery.document.close();
1733: }
1734:
1.42 www 1735: ENDUTILITY
1736: }
1737:
1738: sub serverform {
1739: return(<<ENDSERVERFORM);
1.181 albertel 1740: <form name="server" action="/adm/logout" method="post" target="_top">
1.42 www 1741: <input type="hidden" name="postdata" value="none" />
1742: <input type="hidden" name="command" value="none" />
1743: <input type="hidden" name="url" value="none" />
1744: <input type="hidden" name="symb" value="none" />
1745: </form>
1746: ENDSERVERFORM
1747: }
1.113 albertel 1748:
1.121 raeburn 1749: sub constspaceform {
1750: return(<<ENDCONSTSPACEFORM);
1.181 albertel 1751: <form name="constspace" action="/adm/logout" method="post" target="_top">
1.121 raeburn 1752: <input type="hidden" name="filename" value="" />
1753: </form>
1.181 albertel 1754: <form name="cstrdelete" action="/adm/cfile" method="post" target="_top">
1.121 raeburn 1755: <input type="hidden" name="action" value="delete" />
1756: <input type="hidden" name="filename" value="" />
1757: </form>
1.181 albertel 1758: <form name="cstrprint" action="/adm/printout" target="_parent" method="post">
1.137 raeburn 1759: <input type="hidden" name="postdata" value="" />
1760: <input type="hidden" name="curseed" value="" />
1761: <input type="hidden" name="problemtype" value="" />
1762: </form>
1763:
1.121 raeburn 1764: ENDCONSTSPACEFORM
1765: }
1766:
1767:
1.113 albertel 1768: sub get_nav_status {
1769: my $navstatus="swmenu.w_loncapanav_flag=";
1.152 albertel 1770: if ($env{'environment.remotenavmap'} eq 'on') {
1.113 albertel 1771: $navstatus.="1";
1772: } else {
1773: $navstatus.="-1";
1774: }
1775: return $navstatus;
1776: }
1777:
1.220 raeburn 1778: sub hidden_button_check {
1779: my $hidden;
1780: if ($env{'request.course.id'} eq '') {
1781: return;
1782: }
1783: if ($env{'request.role.adv'}) {
1784: return;
1785: }
1.232 raeburn 1786: my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
1787: return $buttonshide;
1.220 raeburn 1788: }
1.184 raeburn 1789:
1.235 raeburn 1790: sub roles_selector {
1791: my ($cdom,$cnum) = @_;
1.286 raeburn 1792: my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
1793: if ($crstype eq '') {
1794: $crstype = 'Course';
1795: }
1.235 raeburn 1796: my $now = time;
1.262 raeburn 1797: my (%courseroles,%seccount);
1.235 raeburn 1798: my $is_cc;
1799: my $role_selector;
1800: if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
1801: my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
1802:
1803: if ((($start) && ($start<0)) ||
1804: (($end) && ($end<$now)) ||
1805: (($start) && ($now<$start))) {
1806: $is_cc = 0;
1807: } else {
1808: $is_cc = 1;
1809: }
1810: }
1811: if ($is_cc) {
1.264 raeburn 1812: &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
1.235 raeburn 1813: } else {
1.262 raeburn 1814: my %gotnosection;
1.235 raeburn 1815: foreach my $item (keys(%env)) {
1.239 raeburn 1816: if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
1.235 raeburn 1817: my $role = $1;
1818: my $sec = $2;
1819: next if ($role eq 'gr');
1820: my ($start,$end) = split(/\./,$env{$item});
1821: next if (($start && $start > $now) || ($end && $end < $now));
1822: if ($sec eq '') {
1.239 raeburn 1823: if (!$gotnosection{$role}) {
1824: $seccount{$role} ++;
1825: $gotnosection{$role} = 1;
1826: }
1.235 raeburn 1827: }
1828: if (ref($courseroles{$role}) eq 'ARRAY') {
1.239 raeburn 1829: if ($sec ne '') {
1.264 raeburn 1830: if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
1.239 raeburn 1831: push(@{$courseroles{$role}},$sec);
1832: $seccount{$role} ++;
1833: }
1834: }
1835: } else {
1836: @{$courseroles{$role}} = ();
1837: if ($sec ne '') {
1838: $seccount{$role} ++;
1.235 raeburn 1839: push(@{$courseroles{$role}},$sec);
1840: }
1841: }
1842: }
1843: }
1844: }
1.286 raeburn 1845: my $switchtext;
1846: if ($crstype eq 'Community') {
1847: $switchtext = &mt('Switch community role to...')
1848: } else {
1849: $switchtext = &mt('Switch course role to...')
1850: }
1.235 raeburn 1851: my @roles_order = ('cc','in','ta','ep','ad','st');
1852: if (keys(%courseroles) > 1) {
1.239 raeburn 1853: $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
1.235 raeburn 1854: $role_selector .= '<form name="rolechooser" method="post" action="/adm/roles">
1855: <select name="switchrole" onchange="javascript:adhocRole('."'switchrole'".')">';
1.286 raeburn 1856: $role_selector .= '<option value="">'.$switchtext.'</option>';
1.235 raeburn 1857: foreach my $role (@roles_order) {
1858: if (defined($courseroles{$role})) {
1859: $role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role).'</option>';
1860: }
1861: }
1862: foreach my $role (sort(keys(%courseroles))) {
1863: if ($role =~ /^cr/) {
1864: $role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role).'</option>';
1865: }
1866: }
1867: $role_selector .= '</select>'."\n".
1868: '<input type="hidden" name="destinationurl" value="'.
1.282 amueller 1869: &HTML::Entities::encode($ENV{'REQUEST_URI'}).'" />'."\n".
1.235 raeburn 1870: '<input type="hidden" name="gotorole" value="1" />'."\n".
1871: '<input type="hidden" name="selectrole" value="" />'."\n".
1872: '<input type="hidden" name="switch" value="1" />'."\n".
1873: '</form>';
1874: }
1875: return $role_selector;
1876: }
1877:
1.262 raeburn 1878: sub get_all_courseroles {
1879: my ($cdom,$cnum,$courseroles,$seccount) = @_;
1880: unless ((ref($courseroles) eq 'HASH') && (ref($seccount) eq 'HASH')) {
1881: return;
1882: }
1883: my ($result,$cached) =
1884: &Apache::lonnet::is_cached_new('getcourseroles',$cdom.'_'.$cnum);
1885: if (defined($cached)) {
1886: if (ref($result) eq 'HASH') {
1887: if ((ref($result->{'roles'}) eq 'HASH') &&
1888: (ref($result->{'seccount'}) eq 'HASH')) {
1889: %{$courseroles} = %{$result->{'roles'}};
1890: %{$seccount} = %{$result->{'seccount'}};
1891: return;
1892: }
1893: }
1894: }
1895: my %gotnosection;
1896: my %adv_roles =
1897: &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1);
1898: foreach my $role (keys(%adv_roles)) {
1899: my ($urole,$usec) = split(/:/,$role);
1900: if (!$gotnosection{$urole}) {
1901: $seccount->{$urole} ++;
1902: $gotnosection{$urole} = 1;
1903: }
1904: if (ref($courseroles->{$urole}) eq 'ARRAY') {
1905: if ($usec ne '') {
1906: if (!grep(/^Q$usec\E$/,@{$courseroles->{$urole}})) {
1907: push(@{$courseroles->{$urole}},$usec);
1908: $seccount->{$urole} ++;
1909: }
1910: }
1911: } else {
1912: @{$courseroles->{$urole}} = ();
1913: if ($usec ne '') {
1914: $seccount->{$urole} ++;
1915: push(@{$courseroles->{$urole}},$usec);
1916: }
1917: }
1918: }
1919: my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum,['st']);
1920: @{$courseroles->{'st'}} = ();
1921: if (keys(%sections_count) > 0) {
1922: push(@{$courseroles->{'st'}},keys(%sections_count));
1923: $seccount->{'st'} = scalar(keys(%sections_count));
1924: }
1925: my $rolehash = {
1926: 'roles' => $courseroles,
1927: 'seccount' => $seccount,
1928: };
1929: &Apache::lonnet::do_cache_new('getcourseroles',$cdom.'_'.$cnum,$rolehash);
1930: return;
1931: }
1932:
1.235 raeburn 1933: sub jump_to_role {
1.239 raeburn 1934: my ($cdom,$cnum,$seccount,$courseroles) = @_;
1935: my %lt = &Apache::lonlocal::texthash(
1936: this => 'This role has section(s) associated with it.',
1937: ente => 'Enter a specific section.',
1938: orlb => 'Enter a specific section, or leave blank for no section.',
1939: avai => 'Available sections are:',
1940: youe => 'You entered an invalid section choice:',
1941: plst => 'Please try again',
1942: );
1943: my $js;
1944: if (ref($courseroles) eq 'HASH') {
1945: $js = ' var secpick = new Array("'.$lt{'ente'}.'","'.$lt{'orlb'}.'");'."\n".
1946: ' var numsec = new Array();'."\n".
1947: ' var rolesections = new Array();'."\n".
1948: ' var rolenames = new Array();'."\n".
1949: ' var roleseclist = new Array();'."\n";
1950: my @items = keys(%{$courseroles});
1951: for (my $i=0; $i<@items; $i++) {
1952: $js .= ' rolenames['.$i.'] = "'.$items[$i].'";'."\n";
1953: my ($secs,$secstr);
1954: if (ref($courseroles->{$items[$i]}) eq 'ARRAY') {
1955: my @sections = sort { $a <=> $b } @{$courseroles->{$items[$i]}};
1956: $secs = join('","',@sections);
1957: $secstr = join(', ',@sections);
1958: }
1959: $js .= ' rolesections['.$i.'] = new Array("'.$secs.'");'."\n".
1960: ' roleseclist['.$i.'] = "'.$secstr.'";'."\n".
1961: ' numsec['.$i.'] = "'.$seccount->{$items[$i]}.'";'."\n";
1962: }
1963: }
1.273 droeschl 1964: return <<"END";
1.235 raeburn 1965: <script type="text/javascript">
1.273 droeschl 1966: //<![CDATA[
1.235 raeburn 1967: function adhocRole(roleitem) {
1.239 raeburn 1968: $js
1.235 raeburn 1969: var newrole = document.rolechooser.elements[roleitem].options[document.rolechooser.elements[roleitem].selectedIndex].value;
1970: if (newrole == '') {
1971: return;
1972: }
1.239 raeburn 1973: var fullrole = newrole+'./$cdom/$cnum';
1974: var selidx = '';
1975: for (var i=0; i<rolenames.length; i++) {
1976: if (rolenames[i] == newrole) {
1977: selidx = i;
1978: }
1979: }
1980: var secok = 1;
1981: var secchoice = '';
1982: if (selidx >= 0) {
1983: if (numsec[selidx] > 1) {
1984: secok = 0;
1985: var numrolesec = rolesections[selidx].length;
1986: var msgidx = numsec[selidx] - numrolesec;
1987: secchoice = prompt("$lt{'this'}\\n"+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],"");
1988: if (secchoice == '') {
1989: if (msgidx > 0) {
1990: secok = 1;
1991: }
1992: } else {
1993: for (var j=0; j<rolesections[selidx].length; j++) {
1994: if (rolesections[selidx][j] == secchoice) {
1995: secok = 1;
1996: }
1997: }
1998: }
1999: } else {
2000: if (rolesections[selidx].length == 1) {
2001: secchoice = rolesections[selidx][0];
2002: }
2003: }
2004: }
2005: if (secok == 1) {
2006: if (secchoice != '') {
2007: fullrole += '/'+secchoice;
2008: }
2009: } else {
2010: document.rolechooser.elements[roleitem].selectedIndex = 0;
2011: if (secchoice != null) {
2012: alert("$lt{'youe'} \\""+secchoice+"\\".\\n $lt{'plst'}");
2013: }
2014: return;
2015: }
2016: if (fullrole == "$env{'request.role'}") {
1.235 raeburn 2017: return;
2018: }
2019: itemid = retrieveIndex('gotorole');
2020: if (itemid != -1) {
1.239 raeburn 2021: document.rolechooser.elements[itemid].name = fullrole;
1.235 raeburn 2022: }
1.239 raeburn 2023: document.rolechooser.elements[roleitem].options[document.rolechooser.elements[roleitem].selectedIndex].value = fullrole;
1.235 raeburn 2024: document.rolechooser.selectrole.value = '1';
2025: document.rolechooser.submit();
2026: return;
2027: }
2028:
2029: function retrieveIndex(item) {
2030: for (var i=0;i<document.rolechooser.elements.length;i++) {
2031: if (document.rolechooser.elements[i].name == item) {
2032: return i;
2033: }
2034: }
2035: return -1;
2036: }
1.273 droeschl 2037: // ]]>
1.235 raeburn 2038: </script>
2039: END
2040: }
2041:
2042:
1.2 www 2043: # ================================================================ Main Program
2044:
1.16 harris41 2045: BEGIN {
1.166 albertel 2046: if (! defined($readdesk)) {
1.283 droeschl 2047: {
2048: my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
2049: if ( CORE::open( my $config,"<$tabfile") ) {
2050: while (my $configline=<$config>) {
2051: $configline=(split(/\#/,$configline))[0];
2052: $configline=~s/^\s+//;
2053: chomp($configline);
1.209 www 2054: if ($configline=~/^cat\:/) {
1.283 droeschl 2055: my @entries=split(/\:/,$configline);
2056: $category_positions{$entries[2]}=$entries[1];
2057: $category_names{$entries[2]}=$entries[3];
2058: } elsif ($configline=~/^prim\:/) {
2059: my @entries = (split(/\:/, $configline))[1..5];
2060: push @primary_menu, \@entries;
2061: } elsif ($configline=~/^scnd\:/) {
2062: my @entries = (split(/\:/, $configline))[1..5];
2063: push @secondary_menu, \@entries;
2064: } elsif ($configline) {
2065: push(@desklines,$configline);
2066: }
2067: }
2068: CORE::close($config);
2069: }
2070: }
2071: $readdesk='done';
1.2 www 2072: }
2073: }
1.30 www 2074:
1.1 www 2075: 1;
2076: __END__
2077:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>