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