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