File:
[LON-CAPA] /
loncom /
interface /
lonmenu.pm
Revision
1.433:
download - view:
text,
annotated -
select for diffs
Thu May 28 02:53:29 2015 UTC (9 years, 2 months ago) by
raeburn
Branches:
MAIN
CVS tags:
HEAD
- Directory listing of top level of Authoring Space will include a help
item on the right side of the breadcrumbs menu which links to WebDAV
documentation if WebDAV access is enabled for the user.
1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
4: # $Id: lonmenu.pm,v 1.433 2015/05/28 02:53:29 raeburn Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: #
29:
30: =head1 NAME
31:
32: Apache::lonmenu
33:
34: =head1 SYNOPSIS
35:
36: Loads contents of /home/httpd/lonTabs/mydesk.tab,
37: used to generate inline menu, and Main Menu page.
38:
39: This is part of the LearningOnline Network with CAPA project
40: described at http://www.lon-capa.org.
41:
42: =head1 GLOBAL VARIABLES
43:
44: =over
45:
46: =item @desklines
47:
48: Each element of this array contains a line of mydesk.tab that doesn't start with
49: cat, prim or scnd.
50: It gets filled in the BEGIN block of this module.
51:
52: =item %category_names
53:
54: The keys of this hash are the abbreviations used in mydesk.tab in those lines that
55: start with cat, the values are strings representing titles.
56: It gets filled in the BEGIN block of this module.
57:
58: =item %category_members
59:
60: TODO
61:
62: =item %category_positions
63:
64: The keys of this hash are the abbreviations used in mydesk.tab in those lines that
65: start with cat, its values are position vectors (column, row).
66: It gets filled in the BEGIN block of this module.
67:
68: =item $readdesk
69:
70: Indicates that mydesk.tab has been read.
71: It is set to 'done' in the BEGIN block of this module.
72:
73: =item @primary_menu
74:
75: The elements of this array reference arrays that are made up of the components
76: of those lines of mydesk.tab that start with prim:.
77: It is used by primary_menu() to generate the corresponding menu.
78: It gets filled in the BEGIN block of this module.
79:
80: =item %primary_sub_menu
81:
82: The keys of this hash reference are the names of items in the primary_menu array
83: which have sub-menus. For each key, the corresponding value is a reference to
84: an array containing components extracted from lines in mydesk.tab which begin
85: with primsub:.
86: This hash, which is used by primary_menu to generate sub-menus, is populated in
87: the BEGIN block.
88:
89: =item @secondary_menu
90:
91: The elements of this array reference arrays that are made up of the components
92: of those lines of mydesk.tab that start with scnd.
93: It is used by secondary_menu() to generate the corresponding menu.
94: It gets filled in the BEGIN block of this module.
95:
96: =back
97:
98: =head1 SUBROUTINES
99:
100: =over
101:
102: =item prep_menuitems(\@menuitem)
103:
104: This routine wraps a menuitem in proper HTML. It is used by primary_menu() and
105: secondary_menu().
106:
107: =item primary_menu()
108:
109: This routine evaluates @primary_menu and returns a two item array,
110: with the array elements containing XHTML for the left and right sides of
111: the menu that contains the following links: About, Message, Roles, Help, Logout
112: @primary_menu is filled within the BEGIN block of this module with
113: entries from mydesk.tab
114:
115: =item secondary_menu()
116:
117: Same as primary_menu() but operates on @secondary_menu.
118:
119: =item create_submenu()
120:
121: Creates XHTML for unordered list of sub-menu items which belong to a
122: particular top-level menu item. Uses hover pseudo class in css to display
123: dropdown list when mouse hovers over top-level item. Support for IE6
124: (no hover psuedo class) via LC_hoverable class for <li> tag for top-
125: level item, which employs jQuery to handle behavior on mouseover.
126:
127: Inputs: 4 - (a) link and (b) target for anchor href in top level item,
128: (c) title for text wrapped by anchor tag in top level item.
129: (d) reference to array of arrays of sub-menu items.
130:
131: The underlying datastructure used in (d) contains data from mydesk.tab.
132: It consists of an array which has an array for each item appearing in
133: the menu (e.g. [["link", "title", "condition"]] for a single-item menu).
134: create_submenu() supports also the creation of XHTML for nested dropdown
135: menus represented by unordered lists. This is done by replacing the
136: scalar used for the link with an arrayreference containing the menuitems
137: for the nested menu. This can be done recursively so that the next menu
138: may also contain nested submenus.
139:
140: Example:
141: [ # begin of datastructure
142: ["/home/", "Home", "condition1"], # 1st item of the 1st layer menu
143: [ # 2nd item of the 1st layer menu
144: [ # anon. array for nested menu
145: ["/path1", "Path1", undef], # 1st item of the 2nd layer menu
146: ["/path2", "Path2", undef], # 2nd item of the 2nd layer menu
147: [ # 3rd item of the 2nd layer menu
148: [[...], [...], ..., [...]], # containing another menu layer
149: "Sub-Sub-Menu", # title for this container
150: undef
151: ]
152: ], # end of array/nested menu
153: "Sub-Menu", # title for the container item
154: undef
155: ] # end of 2nd item of the 1st layer menu
156: ]
157:
158: =item innerregister()
159:
160: This gets called in order to register a URL in the body of the document
161:
162: =item clear()
163:
164: =item switch()
165:
166: Switch a button or create a link
167: Switch acts on the javascript that is executed when a button is clicked.
168: The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
169:
170: =item secondlevel()
171:
172: =item openmenu()
173:
174: =item inlinemenu()
175:
176: =item rawconfig()
177:
178: =item utilityfunctions()
179:
180: Output from this routine is a number of javascript functions called by
181: items in the inline menu, and in some cases items in the Main Menu page.
182:
183: =item serverform()
184:
185: =item constspaceform()
186:
187: =item get_nav_status()
188:
189: =item hidden_button_check()
190:
191: =item roles_selector()
192:
193: =item jump_to_role()
194:
195: =back
196:
197: =cut
198:
199: package Apache::lonmenu;
200:
201: use strict;
202: use Apache::lonnet;
203: use Apache::lonhtmlcommon();
204: use Apache::loncommon();
205: use Apache::lonenc();
206: use Apache::lonlocal;
207: use Apache::lonmsg();
208: use LONCAPA qw(:DEFAULT :match);
209: use HTML::Entities();
210: use Apache::lonwishlist();
211:
212: use vars qw(@desklines %category_names %category_members %category_positions
213: $readdesk @primary_menu %primary_submenu @secondary_menu);
214:
215: my @inlineremote;
216:
217: sub prep_menuitem {
218: my ($menuitem) = @_;
219: return '' unless(ref($menuitem) eq 'ARRAY');
220: my $link;
221: if ($$menuitem[1]) { # graphical Link
222: $link = "<img class=\"LC_noBorder\""
223: . " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\""
224: . " alt=\"" . &mt($$menuitem[2]) . "\" />";
225: } else { # textual Link
226: $link = &mt($$menuitem[3]);
227: }
228: return '<li><a'
229: # highlighting for new messages
230: . ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '')
231: . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;
232: }
233:
234: # primary_menu() evaluates @primary_menu and returns a two item array,
235: # with the array elements containing XHTML for the left and right sides of
236: # the menu that contains the following links:
237: # Personal, About, Message, Roles, Help, Logout
238: # @primary_menu is filled within the BEGIN block of this module with
239: # entries from mydesk.tab
240: sub primary_menu {
241: my (%menu);
242: # each element of @primary contains following array:
243: # (link url, icon path, alt text, link text, condition, position)
244: my $public;
245: if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
246: || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
247: $public = 1;
248: }
249: foreach my $menuitem (@primary_menu) {
250: # evaluate conditions
251: next if ref($menuitem) ne 'ARRAY'; #
252: next if $$menuitem[4] eq 'nonewmsg' # show links depending on
253: && &Apache::lonmsg::mynewmail(); # whether a new msg
254: next if $$menuitem[4] eq 'newmsg' # arrived or not
255: && !&Apache::lonmsg::mynewmail(); #
256: next if $$menuitem[4] !~ /public/ ##we've a public user,
257: && $public; ##who should not see all
258: ##links
259: next if $$menuitem[4] eq 'onlypublic'# hide links which are
260: && !$public; # only visible to public
261: # users
262: next if $$menuitem[4] eq 'roles' ##show links depending on
263: && &Apache::loncommon::show_course(); ##term 'Courses' or
264: next if $$menuitem[4] eq 'courses' ##'Roles' wanted
265: && !&Apache::loncommon::show_course(); ##
266:
267: my $title = $menuitem->[3];
268: my $position = $menuitem->[5];
269: if ($position eq '') {
270: $position = 'right';
271: }
272: if (defined($primary_submenu{$title})) {
273: my ($link,$target);
274: if ($menuitem->[0] ne '') {
275: $link = $menuitem->[0];
276: $target = '_top';
277: } else {
278: $link = '#';
279: }
280: my @primsub;
281: if (ref($primary_submenu{$title}) eq 'ARRAY') {
282: foreach my $item (@{$primary_submenu{$title}}) {
283: next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'}));
284: next if ((($item->[2] eq 'portfolio') ||
285: ($item->[2] eq 'blog')) &&
286: (!&Apache::lonnet::usertools_access('','',$item->[2],
287: undef,'tools')));
288: push(@primsub,$item);
289: }
290: if (@primsub > 0) {
291: if ($title eq 'Personal' && $env{'user.name'} && $env{'user.domain'} ) {
292: $title = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'});
293: } else {
294: $title = &mt($title);
295: }
296: $menu{$position} .= &create_submenu($link,$target,$title,\@primsub,1);
297: } elsif ($link) {
298: $menu{$position} .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';
299: }
300: }
301: } elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
302: if ($public) {
303: my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
304: my $defdom = &Apache::lonnet::default_login_domain();
305: my $to = &Apache::loncommon::build_recipient_list(undef,
306: 'helpdeskmail',
307: $defdom,$origmail);
308: if ($to ne '') {
309: $menu{$position} .= &prep_menuitem($menuitem);
310: }
311: } else {
312: $menu{$position} .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
313: }
314: } else {
315: $menu{$position} .= prep_menuitem($menuitem);
316: }
317: }
318: my @output = ('','');
319: if ($menu{'left'} ne '') {
320: $output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>";
321: }
322: if ($menu{'right'} ne '') {
323: $output[1] = "<ol class=\"LC_primary_menu LC_floatright LC_right\">$menu{'right'}</ol>";
324: }
325: return @output;
326: }
327:
328: #returns hashref {user=>'',dom=>''} containing:
329: # own name, domain if user is au
330: # name, domain of parent author if user is ca or aa
331: #empty return if user is not an author or not on homeserver
332: #
333: #TODO this should probably be moved somewhere more central
334: #since it can be used by different parts of the system
335: sub getauthor{
336: return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author
337:
338: #co- or assistent author?
339: my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/)
340: ? ($1, $2) #domain, username of the parent author
341: : @env{ ('request.role.domain', 'user.name') }; #own domain, username
342:
343: # current server == home server?
344: my $home = &Apache::lonnet::homeserver($user,$dom);
345: foreach (&Apache::lonnet::current_machine_ids()){
346: return {user => $user, dom => $dom} if $_ eq $home;
347: }
348:
349: # if wrong server
350: return;
351: }
352:
353: sub secondary_menu {
354: my ($httphost) = @_;
355: my $menu;
356:
357: my $crstype = &Apache::loncommon::course_type();
358: my $crs_sec = $env{'request.course.id'} . ($env{'request.course.sec'}
359: ? "/$env{'request.course.sec'}"
360: : '');
361: my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
362: my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};
363: if ($canviewroster eq 'disabled') {
364: undef($canviewroster);
365: }
366: my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec);
367: my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);
368: my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec);
369: my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec);
370: my $canvgr = &Apache::lonnet::allowed('vgr', $crs_sec);
371: my $canmgr = &Apache::lonnet::allowed('mgr', $crs_sec);
372: my $author = &getauthor();
373:
374: my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv);
375: if ($env{'request.course.id'}) {
376: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
377: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
378: if ($canedit) {
379: $showsyllabus = 1;
380: $showfeeds = 1;
381: } else {
382: unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {
383: if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||
384: ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||
385: ($env{'course.'.$env{'request.course.id'}.'.updatedsyllabus'}) ||
386: ($env{'request.course.syllabustime'})) {
387: $showsyllabus = 1;
388: }
389: }
390: if ($env{'request.course.feeds'}) {
391: $showfeeds = 1;
392: }
393: }
394: unless ($canmgr) {
395: my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom);
396: if (keys(%slots) > 0) {
397: $showresv = 1;
398: }
399: }
400: }
401:
402: my ($canmodifycoauthor);
403: if ($env{'request.role'} eq "au./$env{'user.domain'}/") {
404: my $extent = "$env{'user.domain'}/$env{'user.name'}";
405: if ((&Apache::lonnet::allowed('cca',$extent)) ||
406: (&Apache::lonnet::allowed('caa',$extent))) {
407: $canmodifycoauthor = 1;
408: }
409: }
410:
411: my %groups = &Apache::lonnet::get_active_groups(
412: $env{'user.domain'}, $env{'user.name'},
413: $env{'course.' . $env{'request.course.id'} . '.domain'},
414: $env{'course.' . $env{'request.course.id'} . '.num'});
415:
416: my ($roleswitcher_js,$roleswitcher_form);
417:
418: foreach my $menuitem (@secondary_menu) {
419: # evaluate conditions
420: next if ref($menuitem) ne 'ARRAY';
421: next if $$menuitem[4] ne 'always'
422: && ($$menuitem[4] ne 'author' && $$menuitem[4] ne 'cca')
423: && !$env{'request.course.id'};
424: next if $$menuitem[4] =~ /^mdc/
425: && !$canedit;
426: next if $$menuitem[4] eq 'nvgr'
427: && $canvgr;
428: next if $$menuitem[4] eq 'vgr'
429: && !$canvgr;
430: next if $$menuitem[4] eq 'cst'
431: && !$canmodifyuser;
432: next if $$menuitem[4] eq 'ncst'
433: && ($canmodifyuser || !$canviewroster);
434: next if $$menuitem[4] eq 'mgr'
435: && !$canmgr;
436: next if $$menuitem[4] eq 'showresv'
437: && !$showresv;
438: next if $$menuitem[4] eq 'whn'
439: && !$canviewwnew;
440: next if $$menuitem[4] eq 'opa'
441: && !$canmodpara;
442: next if $$menuitem[4] =~ /showgroups$/
443: && !$canviewgrps
444: && !%groups;
445: next if $$menuitem[4] eq 'showsyllabus'
446: && !$showsyllabus;
447: next if $$menuitem[4] eq 'showfeeds'
448: && !$showfeeds;
449: next if $$menuitem[4] eq 'author'
450: && !$author;
451: next if $$menuitem[4] eq 'cca'
452: && !$canmodifycoauthor;
453:
454: if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
455: # special treatment for role selector
456: ($roleswitcher_js,$roleswitcher_form,my $switcher) =
457: &roles_selector(
458: $env{'course.' . $env{'request.course.id'} . '.domain'},
459: $env{'course.' . $env{'request.course.id'} . '.num'},
460: $httphost
461: );
462: $menu .= $switcher;
463: } else {
464: if ($$menuitem[3] eq 'Syllabus' && $env{'request.course.id'}) {
465: my $url = $$menuitem[0];
466: $url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};
467: if (&Apache::lonnet::is_on_map($url)) {
468: unless ($$menuitem[0] =~ /\?register=1/) {
469: $$menuitem[0] .= '?register=1';
470: }
471: } else {
472: $$menuitem[0] =~ s{\?register=1}{};
473: }
474: }
475: $menu .= &prep_menuitem(\@$menuitem);
476: }
477: }
478: if ($menu =~ /\[url\].*\[symb\]/) {
479: my $escurl = &escape( &Apache::lonenc::check_encrypt(
480: $env{'request.noversionuri'}));
481:
482: my $escsymb = &escape( &Apache::lonenc::check_encrypt(
483: $env{'request.symb'}));
484:
485: if ( $env{'request.state'} eq 'construct'
486: and ( $env{'request.noversionuri'} eq ''
487: || !defined($env{'request.noversionuri'})))
488: {
489: my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
490: ($escurl = $env{'request.filename'}) =~ s{^\Q$londocroot\E}{};
491: $escurl = &escape($escurl);
492: }
493: $menu =~ s/\[url\]/$escurl/g;
494: $menu =~ s/\[symb\]/$escsymb/g;
495: }
496: $menu =~ s/\[uname\]/$$author{user}/g;
497: $menu =~ s/\[udom\]/$$author{dom}/g;
498: if ($showsyllabus || $showfeeds) {
499: $menu =~ s/\[cnum\]/$cnum/g;
500: $menu =~ s/\[cdom\]/$cdom/g;
501: }
502: if ($menu) {
503: $menu = "<ul id=\"LC_secondary_menu\">$menu</ul>";
504: }
505: if ($roleswitcher_form) {
506: $menu .= "\n$roleswitcher_js\n$roleswitcher_form";
507: }
508: return $menu;
509: }
510:
511: sub create_submenu {
512: my ($link,$target,$title,$submenu,$translate) = @_;
513: return unless (ref($submenu) eq 'ARRAY');
514: my $disptarget;
515: if ($target ne '') {
516: $disptarget = ' target="'.$target.'"';
517: }
518: my $menu = '<li class="LC_hoverable">'.
519: '<a href="'.$link.'"'.$disptarget.'>'.
520: '<span class="LC_nobreak">'.$title.
521: '<span class="LC_fontsize_small" style="font-weight:normal;">'.
522: ' ▼</span></span></a>'.
523: '<ul>';
524:
525: # $link and $title are only used in the initial string written in $menu
526: # as seen above, not needed for nested submenus
527: $menu .= &build_submenu($target, $submenu, $translate, '1');
528: $menu .= '</ul></li>';
529:
530: return $menu;
531: }
532:
533: # helper routine for create_submenu
534: # build the dropdown (and nested submenus) recursively
535: # see perldoc create_submenu documentation for further information
536: sub build_submenu {
537: my ($target, $submenu, $translate, $first_level) = @_;
538: if (!defined(@{$submenu})) {
539: return '';
540: }
541:
542: my $menu = '';
543: my $count = 0;
544: my $numsub = scalar(@{$submenu});
545: foreach my $item (@{$submenu}) {
546: $count ++;
547: if (ref($item) eq 'ARRAY') {
548: my $href = $item->[0];
549: my $bordertop;
550: my $borderbot;
551: my $title;
552:
553: if ($translate) {
554: $title = &mt($item->[1]);
555: } else {
556: $title = $item->[1];
557: }
558:
559: if ($count == 1 && !$first_level) {
560: $bordertop = 'border-top: 1px solid black;';
561: }
562: if ($count == $numsub) {
563: $borderbot = 'border-bottom: 1px solid black;';
564: }
565:
566: # href is a reference to another submenu
567: if (ref($href) eq 'ARRAY') {
568: $menu .= '<li style="margin:0;padding:0;'.$bordertop . $borderbot . '">';
569: $menu .= '<p><span class="LC_primary_menu_innertitle">'
570: . $title . '</span><span class="LC_primary_menu_innerarrow">▶</span></p>';
571: $menu .= '<ul>';
572: $menu .= &build_submenu($target, $href, $translate);
573: $menu .= '</ul>';
574: $menu .= '</li>';
575: } else { # href is the actual hyperlink and does not represent another submenu
576: # for the current menu title
577: if ($href =~ /(aboutme|rss\.html)$/) {
578: next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne ''));
579: $href =~ s/\[domain\]/$env{'user.domain'}/g;
580: $href =~ s/\[user\]/$env{'user.name'}/g;
581: }
582: unless (($href eq '') || ($href =~ /^\#/)) {
583: $target = ' target="_top"';
584: }
585:
586: $menu .= '<li style="margin:0;padding:0;'. $bordertop . $borderbot .'">';
587: $menu .= '<a href="'.$href.'"'.$target.'>' . $title . '</a>';
588: $menu .= '</li>';
589: }
590: }
591: }
592: return $menu;
593: }
594:
595: sub innerregister {
596: my ($forcereg,$bread_crumbs,$group) = @_;
597: my $const_space = ($env{'request.state'} eq 'construct');
598: my $is_const_dir = 0;
599:
600: if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
601:
602: $env{'request.registered'} = 1;
603:
604: undef(@inlineremote);
605:
606: my ($mapurl,$resurl);
607:
608: if ($env{'request.course.id'}) {
609: if ($env{'request.symb'}) {
610: ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
611: my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
612:
613: my $maptitle = &Apache::lonnet::gettitle($mapurl);
614: my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
615:
616: #SD
617: #course_type only Course and Community?
618: #
619: my @crumbs;
620: unless (($forcereg) &&
621: ($env{'request.noversionuri'} eq '/adm/navmaps') &&
622: ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
623: @crumbs = ({text => Apache::loncommon::course_type()
624: . ' Contents',
625: href => "Javascript:gopost('/adm/navmaps','')"});
626: }
627: if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
628: push(@crumbs, {text => '...',
629: no_mt => 1});
630: }
631:
632: push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle
633: && $maptitle ne 'default.sequence'
634: && $maptitle ne $coursetitle);
635:
636: push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
637: &Apache::lonhtmlcommon::clear_breadcrumbs();
638: &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
639: } else {
640: $resurl = $env{'request.noversionuri'};
641: my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
642: my $crstype = &Apache::loncommon::course_type();
643: my $title = &mt('View Resource');
644: if ($resurl =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) {
645: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folderpath','title']);
646: &Apache::lonhtmlcommon::clear_breadcrumbs();
647: if ($env{'form.title'}) {
648: $title = $env{'form.title'};
649: }
650: my $trail;
651: if ($env{'form.folderpath'}) {
652: &prepare_functions($resurl,$forcereg,$group,undef,undef,1);
653: ($trail) =
654: &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
655: } else {
656: &Apache::lonhtmlcommon::add_breadcrumb(
657: {text => "Supplemental $crstype Content",
658: href => "javascript:gopost('/adm/supplemental','')"});
659: $title = &mt('View Resource');
660: ($trail) =
661: &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
662: }
663: return $trail;
664: } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
665: &Apache::lonhtmlcommon::clear_breadcrumbs();
666: &prepare_functions('/public'.$courseurl."/syllabus",
667: $forcereg,$group,undef,undef,1);
668: $title = &mt('Syllabus File');
669: my ($trail) =
670: &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
671: return $trail;
672: }
673: unless ($env{'request.state'} eq 'construct') {
674: &Apache::lonhtmlcommon::clear_breadcrumbs();
675: &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
676: }
677: }
678: } elsif (! $const_space){
679: #a situation when we're looking at a resource outside of context of a
680: #course or construction space (e.g. with cumulative rights)
681: &Apache::lonhtmlcommon::clear_breadcrumbs();
682: unless ($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) {
683: &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
684: }
685: }
686: # =============================================================================
687: # ============================ This is for URLs that actually can be registered
688: return '' unless ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/})
689: || $forcereg );
690: my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit,
691: $forceview,$editbutton);
692: if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) ||
693: ($env{'request.role'} !~/^(aa|ca|au)/)) {
694: $editbutton = &prepare_functions($resurl,$forcereg,$group);
695: }
696: if ($editbutton eq '') {
697: $editbutton = &clear(6,1);
698: }
699:
700: #
701: # This applies in course context
702: #
703: if ($env{'request.course.id'}) {
704: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
705: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
706: $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
707: my @privs;
708: if ($env{'request.symb'} ne '') {
709: if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {
710: push(@privs,('mgr','vgr'));
711: }
712: push(@privs,'opa');
713: }
714: foreach my $priv (@privs) {
715: $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
716: if (!$perms{$priv} && $env{'request.course.sec'} ne '') {
717: $perms{$priv} =
718: &Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}");
719: }
720: }
721: #
722: # Determine whether or not to show Grades and Submissions buttons
723: #
724: if ($env{'request.symb'} ne '' &&
725: $env{'request.filename'}=~/$LONCAPA::assess_re/) {
726: if ($perms{'mgr'}) {
727: &switch('','',7,2,'pgrd.png','Content Grades','grades[_4]',
728: "gocmd('/adm/grades','gradingmenu')",
729: 'Content Grades');
730: } elsif ($perms{'vgr'}) {
731: &switch('','',7,2,'subm.png','Content Submissions','missions[_1]',
732: "gocmd('/adm/grades','submission')",
733: 'Content Submissions');
734: }
735: }
736: if (($env{'request.symb'} ne '') && ($perms{'opa'})) {
737: &switch('','',7,3,'pparm.png','Content Settings','parms[_2]',
738: "gocmd('/adm/parmset','set')",
739: 'Content Settings');
740: }
741: # End grades/submissions check
742:
743: #
744: # This applies to items inside a folder/page modifiable in the course.
745: #
746: if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) {
747: my $text = 'Edit Folder';
748: if (($mapurl =~ /\.page$/) ||
749: ($env{'request.symb'}=~
750: m{uploaded/$cdom/$cnum/default_\d+\.page$})) {
751: $text = 'Edit Page';
752: }
753: &switch('','',7,4,'docs-22x22.png',$text,'parms[_2]',
754: "gocmd('/adm/coursedocs','direct')",
755: 'Folder/Page Content');
756: }
757: # End modifiable folder/page container check
758: }
759: # End course context
760:
761: # Prepare the rest of the buttons
762: my ($menuitems,$got_prt,$got_wishlist);
763: if ($const_space) {
764: #
765: # We are in construction space
766: #
767:
768: my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
769: my ($udom,$uname,$thisdisfn) =
770: ($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$});
771: my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
772: if ($currdir =~ m-/$-) {
773: $is_const_dir = 1;
774: if ($thisdisfn eq '') {
775: $is_const_dir = 2;
776: }
777: } else {
778: $currdir =~ s|[^/]+$||;
779: my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
780: my $esc_currdir = &Apache::loncommon::escape_single($currdir);
781: #
782: # Probably should be in mydesk.tab
783: #
784: $menuitems=(<<ENDMENUITEMS);
785: s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory
786: s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version
787: s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource
788: s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource
789: s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document
790: ENDMENUITEMS
791: }
792: if (ref($bread_crumbs) eq 'ARRAY') {
793: &Apache::lonhtmlcommon::clear_breadcrumbs();
794: foreach my $crumb (@{$bread_crumbs}){
795: &Apache::lonhtmlcommon::add_breadcrumb($crumb);
796: }
797: }
798: } elsif ( defined($env{'request.course.id'}) &&
799: $env{'request.symb'} ne '' ) {
800: #
801: # We are in a course and looking at a registered URL
802: # Should probably be in mydesk.tab
803: #
804: $menuitems=(<<ENDMENUITEMS);
805: c&3&1
806: s&2&1&back.png&&&gopost('/adm/flip','back:'+currentURL)&Previous content resource&&1
807: s&2&3&forw.png&&&gopost('/adm/flip','forward:'+currentURL)&Next content resource&&3
808: c&6&3
809: c&8&1
810: c&8&2
811: s&8&3&prt.png&Print&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
812: ENDMENUITEMS
813: $got_prt = 1;
814: if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/)
815: && (!$env{'request.enc'})) {
816: # wishlist is only available for users with access to resource-pool
817: # and links can only be set for resources within the resource-pool
818: $menuitems .= (<<ENDMENUITEMS);
819: s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in my personal Stored Links repository&&1
820: ENDMENUITEMS
821: $got_wishlist = 1;
822: }
823:
824: my $currentURL = &Apache::loncommon::get_symb();
825: my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
826: my $annotation = &Apache::loncommon::get_annotation($symb_old,$symb_old_enc);
827: $menuitems.="s&9&3&";
828: if(length($annotation) > 0){
829: $menuitems.="anot2.png";
830: }else{
831: $menuitems.="anot.png";
832: }
833: $menuitems.="&Notes&&annotate()&";
834: $menuitems.="Make notes and annotations about this resource&&1\n";
835: my $is_mobile;
836: if ($env{'browser.mobile'}) {
837: $is_mobile = 1;
838: }
839:
840: unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
841: if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
842: $menuitems.=(<<ENDREALRES);
843: s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata
844: ENDREALRES
845: }
846: unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||
847: ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/})) {
848: $menuitems.=(<<ENDREALRES);
849: s&8&1&eval.png&Evaluate&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
850: ENDREALRES
851: }
852: unless ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/}) {
853: $menuitems.=(<<ENDREALRES);
854: s&8&2&fdbk.png&Communicate&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource
855: ENDREALRES
856: }
857: }
858: }
859: if ($env{'request.uri'} =~ /^\/res/) {
860: unless ($got_prt) {
861: $menuitems .= (<<ENDMENUITEMS);
862: s&8&3&prt.png&Print&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
863: ENDMENUITEMS
864: $got_prt = 1;
865: }
866: unless ($got_wishlist) {
867: if (($env{'user.adv'}) && (!$env{'request.enc'})) {
868: # wishlist is only available for users with access to resource-pool
869: $menuitems .= (<<ENDMENUITEMS);
870: s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1
871: ENDMENUITEMS
872: $got_wishlist = 1;
873: }
874: }
875: }
876: my $buttons='';
877: foreach (split(/\n/,$menuitems)) {
878: my ($command,@rest)=split(/\&/,$_);
879: my $idx=10*$rest[0]+$rest[1];
880: if (&hidden_button_check() eq 'yes') {
881: if ($idx == 21 ||$idx == 23) {
882: $buttons.=&switch('','',@rest);
883: } else {
884: $buttons.=&clear(@rest);
885: }
886: } else {
887: if ($command eq 's') {
888: $buttons.=&switch('','',@rest);
889: } else {
890: $buttons.=&clear(@rest);
891: }
892: }
893: }
894:
895: my $addremote=0;
896: foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
897: if ($addremote) {
898:
899: &Apache::lonhtmlcommon::clear_breadcrumb_tools();
900:
901: &Apache::lonhtmlcommon::add_breadcrumb_tool(
902: 'navigation', @inlineremote[21,23]);
903:
904: my $countdown = &countdown_timer();
905: if (&hidden_button_check() eq 'yes') {
906: if ($countdown) {
907: &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
908: }
909: } else {
910: my @tools = @inlineremote[93,91,81,82,83];
911: if ($countdown) {
912: unshift(@tools,$countdown);
913: }
914: &Apache::lonhtmlcommon::add_breadcrumb_tool(
915: 'tools',@tools);
916:
917: #publish button in construction space
918: if ($env{'request.state'} eq 'construct'){
919: &Apache::lonhtmlcommon::add_breadcrumb_tool(
920: 'advtools', $inlineremote[63]);
921: } else {
922: &Apache::lonhtmlcommon::add_breadcrumb_tool(
923: 'tools', $inlineremote[63]);
924: }
925: &advtools_crumbs(@inlineremote);
926: }
927: }
928: my ($topic_help,$topic_help_text);
929: if ($is_const_dir == 2) {
930: if (&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav')) {
931: $topic_help = 'Authoring_WebDAV,Authoring_WebDAV_Mac_10v6,Authoring_WebDAV_Mac_10v10,'.
932: 'Authoring_WebDAV_Windows_v7,Authoring_WebDAV_Linux_Centos';
933: $topic_help_text = 'About WebDAV access';
934: }
935: }
936: return &Apache::lonhtmlcommon::scripttag('', 'start')
937: . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text)
938: . &Apache::lonhtmlcommon::scripttag('', 'end');
939: }
940:
941: sub get_editbutton {
942: my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;
943: my $jscall;
944: if (($forceview) && ($env{'form.todocs'})) {
945: my ($folderpath,$command);
946: if ($env{'request.symb'}) {
947: $folderpath = &Apache::loncommon::symb_to_docspath($env{'request.symb'});
948: } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
949: $folderpath = $env{'form.folderpath'};
950: $command = '&forcesupplement=1';
951: }
952: $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"'));
953: $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')";
954: } else {
955: $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
956: $forceedit,$forcereg,$env{'request.symb'},
957: &escape($env{'form.folderpath'}),
958: &escape($env{'form.title'}),$env{'form.idx'},
959: &escape($env{'form.suppurl'},$env{'form.todocs'}));
960: }
961: if ($jscall) {
962: my $icon = 'pcstr.png';
963: my $label = 'Edit';
964: if ($forceview) {
965: $icon = 'tolastloc.png';
966: $label = 'Exit Editing';
967: }
968: &switch('','',6,1,$icon,$label,'resource[_2]',
969: $jscall,"Edit this resource");
970: return 1;
971: }
972: return;
973: }
974:
975: sub prepare_functions {
976: my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs) = @_;
977: unless ($env{'request.registered'}) {
978: undef(@inlineremote);
979: }
980: my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit,
981: $forceview);
982:
983: if ($env{'request.course.id'}) {
984: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
985: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
986: $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
987: }
988:
989: my $editbutton = '';
990: #
991: # Determine whether or not to display 'Edit' icon/button
992: #
993: if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {
994: my $file=&Apache::lonnet::declutter($env{'request.filename'});
995: ($cfile,$home,$switchserver,$forceedit,$forceview) =
996: &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
997: &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
998: if (($cfile) && ($home ne '') && ($home ne 'no_host')) {
999: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1000: $forceedit,$forceview,$forcereg);
1001: }
1002: } elsif ((!$env{'request.course.id'}) &&
1003: ($env{'user.author'}) && ($env{'request.filename'}) &&
1004: ($env{'request.role'} !~/^(aa|ca|au)/)) {
1005: #
1006: # Currently do not have the role of author or co-author.
1007: # Do we have authoring privileges for the resource?
1008: #
1009: my $file=&Apache::lonnet::declutter($env{'request.filename'});
1010: ($cfile,$home,$switchserver,$forceedit,$forceview) =
1011: &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
1012: &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
1013: if (($cfile) && ($home ne '') && ($home ne 'no_host')) {
1014: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1015: $forceedit,$forceview,$forcereg);
1016: }
1017: } elsif ($env{'request.course.id'}) {
1018: #
1019: # This applies in course context
1020: #
1021: if (($perms{'mdc'}) &&
1022: (($resurl eq "/public/$cdom/$cnum/syllabus") ||
1023: ($resurl =~ m{^/uploaded/$cdom/$cnum/portfolio/syllabus/}))) {
1024: $cfile = $resurl;
1025: $home = &Apache::lonnet::homeserver($cnum,$cdom);
1026: if ($env{'form.forceedit'}) {
1027: $forceview = 1;
1028: } else {
1029: $forceedit = 1;
1030: }
1031: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1032: $forceedit,$forceview,$forcereg);
1033: } elsif (($resurl eq '/adm/extresedit') &&
1034: (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
1035: ($cfile,$home,$switchserver,$forceedit,$forceview) =
1036: &Apache::lonnet::can_edit_resource($resurl,$cnum,$cdom,$resurl,
1037: $env{'form.symb'});
1038: if ($cfile ne '') {
1039: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1040: $forceedit,$forceview,$forcereg,
1041: $env{'form.title'},$env{'form.suppurl'});
1042: }
1043: } elsif (($resurl =~ m{^/?adm/viewclasslist$}) &&
1044: (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
1045: ($cfile,$home,$switchserver,$forceedit,$forceview) =
1046: &Apache::lonnet::can_edit_resource($resurl,$cnum,$cdom,$resurl,
1047: $env{'form.symb'});
1048: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1049: $forceedit,$forceview,$forcereg);
1050: } elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) &&
1051: ($resurl ne '/cgi-bin/printout.pl')) {
1052: if ($env{'request.filename'}) {
1053: my $file=&Apache::lonnet::declutter($env{'request.filename'});
1054: ($cfile,$home,$switchserver,$forceedit,$forceview) =
1055: &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
1056: &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
1057: if ($cfile ne '') {
1058: $editbutton = &get_editbutton($cfile,$home,$switchserver,
1059: $forceedit,$forceview,$forcereg);
1060: }
1061: }
1062: }
1063: }
1064: # End determination of 'Edit' icon/button display
1065:
1066: if ($env{'request.course.id'}) {
1067: # This applies to about me page for users in a course
1068: if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {
1069: my ($sdom,$sname) = ($1,$2);
1070: unless (&Apache::lonnet::is_course($sdom,$sname)) {
1071: &switch('','',6,4,'mail-message-new-22x22.png','Message to user',
1072: '',
1073: "go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')",
1074: 'Send message to specific user');
1075: }
1076: my $hideprivileged = 1;
1077: if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum,undef,
1078: $hideprivileged)) {
1079: foreach my $priv ('vsa','vgr','srm') {
1080: $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
1081: if (!$perms{$priv} && $env{'request.course.sec'} ne '') {
1082: $perms{$priv} =
1083: &Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}");
1084: }
1085: }
1086: if ($perms{'vsa'}) {
1087: &switch('','',6,5,'trck-22x22.png','Activity',
1088: '',
1089: "go('/adm/trackstudent?selected_student=$sname:$sdom')",
1090: 'View recent activity by this person');
1091: }
1092: if ($perms{'vgr'}) {
1093: &switch('','',6,6,'rsrv-22x22.png','Reservations',
1094: '',
1095: "go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')",
1096: 'Slot reservation history');
1097: }
1098: if ($perms{'srm'}) {
1099: &switch('','',6,7,'contact-new-22x22.png','Records',
1100: '',
1101: "go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')",
1102: 'Add records');
1103: }
1104: }
1105: }
1106: if (($env{'form.folderpath'} =~ /^supplemental/) &&
1107: (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
1108: (($resurl =~ m{^/adm/wrapper/ext/}) ||
1109: ($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) ||
1110: ($resurl eq '/adm/supplemental') ||
1111: ($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) ||
1112: ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) {
1113: my @folders=split('&',$env{'form.folderpath'});
1114: if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {
1115: my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
1116: &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
1117: "location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'",
1118: 'Folder/Page Content');
1119: }
1120: }
1121: }
1122:
1123: # End checking for items for about me page for users in a course
1124: if ($docscrumbs) {
1125: &Apache::lonhtmlcommon::clear_breadcrumb_tools();
1126: &advtools_crumbs(@inlineremote);
1127: return $editbutton;
1128: } elsif ($env{'request.registered'}) {
1129: return $editbutton;
1130: } else {
1131: if (ref($bread_crumbs) eq 'ARRAY') {
1132: if (@inlineremote > 0) {
1133: if (ref($advtools) eq 'ARRAY') {
1134: @{$advtools} = @inlineremote;
1135: }
1136: }
1137: return;
1138: } elsif (@inlineremote > 0) {
1139: &Apache::lonhtmlcommon::clear_breadcrumb_tools();
1140: &advtools_crumbs(@inlineremote);
1141: return &Apache::lonhtmlcommon::scripttag('', 'start')
1142: . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)
1143: . &Apache::lonhtmlcommon::scripttag('', 'end');
1144: }
1145: }
1146: }
1147:
1148: sub advtools_crumbs {
1149: my @funcs = @_;
1150: if ($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) {
1151: &Apache::lonhtmlcommon::add_breadcrumb_tool(
1152: 'advtools', @funcs[61,64,65,66,67,74]);
1153: } elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
1154: &Apache::lonhtmlcommon::add_breadcrumb_tool(
1155: 'advtools', @funcs[61,71,72,73,74,92]);
1156: } elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') {
1157: &Apache::lonhtmlcommon::add_breadcrumb_tool(
1158: 'advtools', $funcs[61]);
1159: }
1160: return;
1161: }
1162:
1163: # ================================================================== Raw Config
1164:
1165: sub clear {
1166: my ($row,$col)=@_;
1167: $inlineremote[10*$row+$col]='';
1168: return '';
1169: }
1170:
1171: # ============================================ Switch a button or create a link
1172: # Switch acts on the javascript that is executed when a button is clicked.
1173: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
1174:
1175: sub switch {
1176: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_;
1177: $act=~s/\$uname/$uname/g;
1178: $act=~s/\$udom/$udom/g;
1179: $top=&mt($top);
1180: $bot=&mt($bot);
1181: $desc=&mt($desc);
1182: my $idx=10*$row+$col;
1183: $category_members{$cat}.=':'.$idx;
1184:
1185: # Inline Menu
1186: if ($nobreak==2) { return ''; }
1187: my $text=$top.' '.$bot;
1188: $text=~s/\s*\-\s*//gs;
1189:
1190: my $pic=
1191: '<img alt="'.$text.'" src="'.
1192: &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
1193: '" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />';
1194: if ($env{'browser.interface'} eq 'faketextual') {
1195: # Main Menu
1196: if ($nobreak==3) {
1197: $inlineremote[$idx]="\n".
1198: '<td class="LC_menubuttons_text" align="right">'.$text.
1199: '</td><td align="left">'.
1200: '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
1201: } elsif ($nobreak) {
1202: $inlineremote[$idx]="\n<tr>".
1203: '<td align="left">'.
1204: '<a href="javascript:'.$act.';">'.$pic.'</a></td>
1205: <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>';
1206: } else {
1207: $inlineremote[$idx]="\n<tr>".
1208: '<td align="left">'.
1209: '<a href="javascript:'.$act.';">'.$pic.
1210: '</a></td><td class="LC_menubuttons_text" colspan="3">'.
1211: '<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>';
1212: }
1213: } else {
1214: # Inline Menu
1215: my @tools = (93,91,81,82,83);
1216: unless ($env{'request.state'} eq 'construct') {
1217: push(@tools,63);
1218: }
1219: if (($env{'environment.icons'} eq 'iconsonly') &&
1220: (grep(/^$idx$/,@tools))) {
1221: $inlineremote[$idx] =
1222: '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.'</a>';
1223: } else {
1224: $inlineremote[$idx] =
1225: '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
1226: '<span class="LC_menubuttons_inline_text">'.$top.' </span></a>';
1227: }
1228: }
1229: return '';
1230: }
1231:
1232: sub secondlevel {
1233: my $output='';
1234: my
1235: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat)=@_;
1236: if ($prt eq 'any') {
1237: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1238: } elsif ($prt=~/^r(\w+)/) {
1239: if ($rol eq $1) {
1240: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1241: }
1242: }
1243: return $output;
1244: }
1245:
1246: sub inlinemenu {
1247: undef(@inlineremote);
1248: undef(%category_members);
1249: # calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
1250: &rawconfig(1);
1251: my $output='<table><tr>';
1252: for (my $col=1; $col<=2; $col++) {
1253: $output.='<td class="LC_mainmenu_col_fieldset">';
1254: for (my $row=1; $row<=8; $row++) {
1255: foreach my $cat (keys(%category_members)) {
1256: if ($category_positions{$cat} ne "$col,$row") { next; }
1257: #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
1258: $output.='<div class="LC_Box LC_400Box">';
1259: $output.='<h3 class="LC_hcell">'.&mt($category_names{$cat}).'</h3>';
1260: $output.='<table>';
1261: my %active=();
1262: foreach my $menu_item (split(/\:/,$category_members{$cat})) {
1263: if ($inlineremote[$menu_item]) {
1264: $active{$menu_item}=1;
1265: }
1266: }
1267: foreach my $item (sort(keys(%active))) {
1268: $output.=$inlineremote[$item];
1269: }
1270: $output.='</table>';
1271: $output.='</div>';
1272: }
1273: }
1274: $output.="</td>";
1275: }
1276: $output.="</tr></table>";
1277: return $output;
1278: }
1279:
1280: sub rawconfig {
1281: #
1282: # This evaluates mydesk.tab
1283: # Need to add more positions and more privileges to deal with all
1284: # menu items.
1285: #
1286: my $textualoverride=shift;
1287: my $output='';
1288: return '' unless $textualoverride;
1289: my $uname=$env{'user.name'};
1290: my $udom=$env{'user.domain'};
1291: my $adv=$env{'user.adv'};
1292: my $show_course=&Apache::loncommon::show_course();
1293: my $author=$env{'user.author'};
1294: my $crs='';
1295: my $crstype='';
1296: if ($env{'request.course.id'}) {
1297: $crs='/'.$env{'request.course.id'};
1298: if ($env{'request.course.sec'}) {
1299: $crs.='_'.$env{'request.course.sec'};
1300: }
1301: $crs=~s/\_/\//g;
1302: $crstype = &Apache::loncommon::course_type();
1303: }
1304: my $pub=($env{'request.state'} eq 'published');
1305: my $con=($env{'request.state'} eq 'construct');
1306: my $rol=$env{'request.role'};
1307: my $requested_domain;
1308: if ($rol) {
1309: $requested_domain = $env{'request.role.domain'};
1310: }
1311: foreach my $line (@desklines) {
1312: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
1313: $prt=~s/\$uname/$uname/g;
1314: $prt=~s/\$udom/$udom/g;
1315: if ($prt =~ /\$crs/) {
1316: next unless ($env{'request.course.id'});
1317: next if ($crstype eq 'Community');
1318: $prt=~s/\$crs/$crs/g;
1319: } elsif ($prt =~ /\$cmty/) {
1320: next unless ($env{'request.course.id'});
1321: next if ($crstype ne 'Community');
1322: $prt=~s/\$cmty/$crs/g;
1323: }
1324: if ($prt =~ m/\$requested_domain/) {
1325: if ((!$requested_domain) && ($pro eq 'pbre') && ($env{'user.adv'})) {
1326: $prt=~s/\$requested_domain/$env{'user.domain'}/g;
1327: } else {
1328: $prt=~s/\$requested_domain/$requested_domain/g;
1329: }
1330: }
1331: if ($category_names{$cat}!~/\w/) { $cat='oth'; }
1332: if ($pro eq 'clear') {
1333: $output.=&clear($row,$col);
1334: } elsif ($pro eq 'any') {
1335: $output.=&secondlevel(
1336: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1337: } elsif ($pro eq 'smp') {
1338: unless ($adv) {
1339: $output.=&secondlevel(
1340: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1341: }
1342: } elsif ($pro eq 'adv') {
1343: if ($adv) {
1344: $output.=&secondlevel(
1345: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1346: }
1347: } elsif ($pro eq 'shc') {
1348: if ($show_course) {
1349: $output.=&secondlevel(
1350: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1351: }
1352: } elsif ($pro eq 'nsc') {
1353: if (!$show_course) {
1354: $output.=&secondlevel(
1355: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1356: }
1357: } elsif (($pro=~/^p(\w+)/) && ($prt)) {
1358: my $priv = $1;
1359: if ($priv =~ /^mdc(Course|Community)/) {
1360: if ($crstype eq $1) {
1361: $priv = 'mdc';
1362: } else {
1363: next;
1364: }
1365: }
1366: if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) ||
1367: (($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) {
1368: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1369: }
1370: } elsif ($pro eq 'course') {
1371: if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
1372: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1373: }
1374: } elsif ($pro eq 'community') {
1375: if (($env{'request.course.fn'}) && ($crstype eq 'Community')) {
1376: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1377: }
1378: } elsif ($pro =~ /^courseenv_(.*)$/) {
1379: my $key = $1;
1380: if ($crstype ne 'Community') {
1381: my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
1382: if ($key eq 'canuse_pdfforms') {
1383: if ($env{'request.course.id'} && $coursepref eq '') {
1384: my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
1385: $coursepref = $domdefs{'canuse_pdfforms'};
1386: }
1387: }
1388: if ($coursepref) {
1389: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1390: }
1391: }
1392: } elsif ($pro =~ /^communityenv_(.*)$/) {
1393: my $key = $1;
1394: if ($crstype eq 'Community') {
1395: my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
1396: if ($key eq 'canuse_pdfforms') {
1397: if ($env{'request.course.id'} && $coursepref eq '') {
1398: my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
1399: $coursepref = $domdefs{'canuse_pdfforms'};
1400: }
1401: }
1402: if ($coursepref) {
1403: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1404: }
1405: }
1406: } elsif ($pro =~ /^course_(.*)$/) {
1407: # Check for permissions inside of a course
1408: if (($env{'request.course.id'}) && ($crstype ne 'Community') &&
1409: (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
1410: ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
1411: )) {
1412: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1413: }
1414: } elsif ($pro =~ /^community_(.*)$/) {
1415: # Check for permissions inside of a community
1416: if (($env{'request.course.id'}) && ($crstype eq 'Community') &&
1417: (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
1418: ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
1419: )) {
1420: $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1421: }
1422: } elsif ($pro eq 'author') {
1423: if ($author) {
1424: if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
1425: (($prt eq 'raa') && ($env{'request.role'}=~/^aa/)) ||
1426: (($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
1427: # Check that we are on the correct machine
1428: my $cadom=$requested_domain;
1429: my $caname=$env{'user.name'};
1430: if (($prt eq 'rca') || ($prt eq 'raa')) {
1431: ($cadom,$caname)=
1432: ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
1433: }
1434: $act =~ s/\$caname/$caname/g;
1435: $act =~ s/\$cadom/$cadom/g;
1436: my $home = &Apache::lonnet::homeserver($caname,$cadom);
1437: my $allowed=0;
1438: my @ids=&Apache::lonnet::current_machine_ids();
1439: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
1440: if ($allowed) {
1441: $output.=&switch($caname,$cadom,
1442: $row,$col,$img,$top,$bot,$act,$desc,$cat);
1443: }
1444: }
1445: }
1446: } elsif ($pro eq 'tools') {
1447: my @tools = ('aboutme','blog','portfolio');
1448: if (grep(/^\Q$prt\E$/,@tools)) {
1449: if (!&Apache::lonnet::usertools_access($env{'user.name'},
1450: $env{'user.domain'},
1451: $prt,undef,'tools')) {
1452: $output.=&clear($row,$col);
1453: next;
1454: }
1455: } elsif (($prt eq 'reqcrsnsc') || ($prt eq 'reqcrsshc')) {
1456: if (($prt eq 'reqcrsnsc') && ($show_course)) {
1457: next;
1458: }
1459: if (($prt eq 'reqcrsshc') && (!$show_course)) {
1460: next;
1461: }
1462: my $showreqcrs = &check_for_rcrs();
1463: if (!$showreqcrs) {
1464: $output.=&clear($row,$col);
1465: next;
1466: }
1467: }
1468: $prt='any';
1469: $output.=&secondlevel(
1470: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1471: }
1472: }
1473: return $output;
1474: }
1475:
1476: sub check_for_rcrs {
1477: my $showreqcrs = 0;
1478: my @reqtypes = ('official','unofficial','community','textbook');
1479: foreach my $type (@reqtypes) {
1480: if (&Apache::lonnet::usertools_access($env{'user.name'},
1481: $env{'user.domain'},
1482: $type,undef,'requestcourses')) {
1483: $showreqcrs = 1;
1484: last;
1485: }
1486: }
1487: if (!$showreqcrs) {
1488: foreach my $type (@reqtypes) {
1489: if ($env{'environment.reqcrsotherdom.'.$type} ne '') {
1490: $showreqcrs = 1;
1491: last;
1492: }
1493: }
1494: }
1495: return $showreqcrs;
1496: }
1497:
1498: sub dc_popup_js {
1499: my %lt = &Apache::lonlocal::texthash(
1500: more => '(More ...)',
1501: less => '(Less ...)',
1502: );
1503: return <<"END";
1504:
1505: function showCourseID() {
1506: document.getElementById('dccid').style.display='block';
1507: document.getElementById('dccid').style.textAlign='left';
1508: document.getElementById('dccid').style.textFace='normal';
1509: document.getElementById('dccidtext').innerHTML ='<a href="javascript:hideCourseID();" class="LC_menubuttons_link">$lt{'less'}</a>';
1510: return;
1511: }
1512:
1513: function hideCourseID() {
1514: document.getElementById('dccid').style.display='none';
1515: document.getElementById('dccidtext').innerHTML ='<a href="javascript:showCourseID()" class="LC_menubuttons_link">$lt{'more'}</a>';
1516: return;
1517: }
1518:
1519: END
1520:
1521: }
1522:
1523: sub countdown_toggle_js {
1524: return <<"END";
1525:
1526: function toggleCountdown() {
1527: var countdownid = document.getElementById('duedatecountdown');
1528: var currstyle = countdownid.style.display;
1529: if (currstyle == 'inline') {
1530: countdownid.style.display = 'none';
1531: document.getElementById('ddcountcollapse').innerHTML='';
1532: document.getElementById('ddcountexpand').innerHTML='◄ ';
1533: } else {
1534: countdownid.style.display = 'inline';
1535: document.getElementById('ddcountcollapse').innerHTML='► ';
1536: document.getElementById('ddcountexpand').innerHTML='';
1537: }
1538: return;
1539: }
1540:
1541: END
1542: }
1543:
1544: sub utilityfunctions {
1545: my ($httphost) = @_;
1546: my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1547: if ($currenturl =~ m{^/adm/wrapper/ext/}
1548: && $env{'request.external.querystring'} ) {
1549: $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
1550: }
1551: $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
1552:
1553: my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1554:
1555: my $dc_popup_cid;
1556: if ($env{'user.adv'} && exists($env{'user.role.dc./'.
1557: $env{'course.'.$env{'request.course.id'}.
1558: '.domain'}.'/'})) {
1559: $dc_popup_cid = &dc_popup_js();
1560: }
1561:
1562: my $start_page_annotate =
1563: &Apache::loncommon::start_page('Annotator',undef,
1564: {'only_body' => 1,
1565: 'js_ready' => 1,
1566: 'bgcolor' => '#BBBBBB',
1567: 'add_entries' => {
1568: 'onload' => 'javascript:document.goannotate.submit();'}});
1569:
1570: my $end_page_annotate =
1571: &Apache::loncommon::end_page({'js_ready' => 1});
1572:
1573: my $jumptores = &Apache::lonhtmlcommon::javascript_jumpto_resource();
1574:
1575: my $esc_url=&escape($currenturl);
1576: my $esc_symb=&escape($currentsymb);
1577:
1578: my $countdown = &countdown_toggle_js();
1579:
1580: my $hostvar = '
1581: function setLCHost() {
1582: var lcHostname="";
1583: ';
1584: if ($httphost =~ m{^https?\://}) {
1585: $hostvar .= ' var lcServer="'.$httphost.'";'."\n".
1586: ' var hostReg = /^https?:\/\/([^\/]+)$/i;'."\n".
1587: ' var match = hostReg.exec(lcServer);'."\n".
1588: ' if (match.length) {'."\n".
1589: ' if (match[1] == location.hostname) {'."\n".
1590: ' lcHostname=lcServer;'."\n".
1591: ' }'."\n".
1592: ' }'."\n";
1593: }
1594:
1595: $hostvar .= ' return lcHostname;'."\n".
1596: '}'."\n";
1597:
1598: return (<<ENDUTILITY)
1599: $hostvar
1600: var currentURL=unescape("$esc_url");
1601: var reloadURL=unescape("$esc_url");
1602: var currentSymb=unescape("$esc_symb");
1603:
1604: $dc_popup_cid
1605:
1606: $jumptores
1607:
1608: function gopost(url,postdata) {
1609: if (url!='') {
1610: var lcHostname = setLCHost();
1611: this.document.server.action=lcHostname+url;
1612: this.document.server.postdata.value=postdata;
1613: this.document.server.command.value='';
1614: this.document.server.url.value='';
1615: this.document.server.symb.value='';
1616: this.document.server.submit();
1617: }
1618: }
1619:
1620: function gocmd(url,cmd) {
1621: if (url!='') {
1622: var lcHostname = setLCHost();
1623: this.document.server.action=lcHostname+url;
1624: this.document.server.postdata.value='';
1625: this.document.server.command.value=cmd;
1626: this.document.server.url.value=currentURL;
1627: this.document.server.symb.value=currentSymb;
1628: this.document.server.submit();
1629: }
1630: }
1631:
1632: function gocstr(url,filename) {
1633: if (url == '/adm/cfile?action=delete') {
1634: this.document.cstrdelete.filename.value = filename
1635: this.document.cstrdelete.submit();
1636: return;
1637: }
1638: if (url == '/adm/printout') {
1639: this.document.cstrprint.postdata.value = filename
1640: this.document.cstrprint.curseed.value = 0;
1641: this.document.cstrprint.problemtype.value = 0;
1642: if (this.document.lonhomework) {
1643: if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
1644: this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
1645: }
1646: if (this.document.lonhomework.problemtype) {
1647: if (this.document.lonhomework.problemtype.value) {
1648: this.document.cstrprint.problemtype.value =
1649: this.document.lonhomework.problemtype.value;
1650: } else if (this.document.lonhomework.problemtype.options) {
1651: for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
1652: if (this.document.lonhomework.problemtype.options[i].selected) {
1653: if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') {
1654: this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
1655: }
1656: }
1657: }
1658: }
1659: }
1660: }
1661: this.document.cstrprint.submit();
1662: return;
1663: }
1664: if (url !='') {
1665: this.document.constspace.filename.value = filename;
1666: this.document.constspace.action = url;
1667: this.document.constspace.submit();
1668: }
1669: }
1670:
1671: function golist(url) {
1672: if (url!='' && url!= null) {
1673: currentURL = null;
1674: currentSymb= null;
1675: var lcHostname = setLCHost();
1676: top.location.href=lcHostname+url;
1677: }
1678: }
1679:
1680:
1681:
1682: function catalog_info(isMobile) {
1683: if (isMobile == 1) {
1684: openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');
1685: } else {
1686: loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
1687: }
1688: }
1689:
1690: function chat_win() {
1691: var lcHostname = setLCHost();
1692: lonchat=window.open(lcHostname+'/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no');
1693: }
1694:
1695: function group_chat(group) {
1696: var lcHostname = setLCHost();
1697: var url = lcHostname+'/adm/groupchat?group='+group;
1698: var winName = 'LONchat_'+group;
1699: grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
1700: }
1701:
1702: function annotate() {
1703: w_Annotator_flag=1;
1704: annotator=window.open('','Annotator','width=365,height=265,scrollbars=0');
1705: annotator.document.write(
1706: '$start_page_annotate'
1707: +"<form name='goannotate' target='Annotator' method='post' "
1708: +"action='/adm/annotations'>"
1709: +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
1710: +"<\\/form>"
1711: +'$end_page_annotate');
1712: annotator.document.close();
1713: }
1714:
1715: function open_StoredLinks_Import(rat) {
1716: var newWin;
1717: var lcHostname = setLCHost();
1718: if (rat) {
1719: newWin = window.open(lcHostname+'/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,
1720: 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
1721: }
1722: else {
1723: newWin = window.open(lcHostname+'/adm/wishlist?inhibitmenu=yes&mode=import',
1724: 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
1725: }
1726: newWin.focus();
1727: }
1728:
1729: (function (\$) {
1730: \$(document).ready(function () {
1731: \$.single=function(a){return function(b){a[0]=b;return a}}(\$([1]));
1732: /*\@cc_on
1733: if (!window.XMLHttpRequest) {
1734: \$('.LC_hoverable').each(function () {
1735: this.attachEvent('onmouseenter', function (evt) { \$.single(evt.srcElement).addClass('hover'); });
1736: this.attachEvent('onmouseleave', function (evt) { \$.single(evt.srcElement).removeClass('hover'); });
1737: });
1738: }
1739: \@*/
1740: });
1741: }(jQuery));
1742:
1743: $countdown
1744:
1745: ENDUTILITY
1746: }
1747:
1748: sub serverform {
1749: return(<<ENDSERVERFORM);
1750: <form name="server" action="/adm/logout" method="post" target="_top">
1751: <input type="hidden" name="postdata" value="none" />
1752: <input type="hidden" name="command" value="none" />
1753: <input type="hidden" name="url" value="none" />
1754: <input type="hidden" name="symb" value="none" />
1755: </form>
1756: ENDSERVERFORM
1757: }
1758:
1759: sub constspaceform {
1760: return(<<ENDCONSTSPACEFORM);
1761: <form name="constspace" action="/adm/logout" method="post" target="_top">
1762: <input type="hidden" name="filename" value="" />
1763: </form>
1764: <form name="cstrdelete" action="/adm/cfile" method="post" target="_top">
1765: <input type="hidden" name="action" value="delete" />
1766: <input type="hidden" name="filename" value="" />
1767: </form>
1768: <form name="cstrprint" action="/adm/printout" target="_parent" method="post">
1769: <input type="hidden" name="postdata" value="" />
1770: <input type="hidden" name="curseed" value="" />
1771: <input type="hidden" name="problemtype" value="" />
1772: </form>
1773:
1774: ENDCONSTSPACEFORM
1775: }
1776:
1777: sub hidden_button_check {
1778: if ( $env{'request.course.id'} eq ''
1779: || $env{'request.role.adv'} ) {
1780:
1781: return;
1782: }
1783: my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
1784: return $buttonshide;
1785: }
1786:
1787: sub roles_selector {
1788: my ($cdom,$cnum,$httphost) = @_;
1789: my $crstype = &Apache::loncommon::course_type();
1790: my $now = time;
1791: my (%courseroles,%seccount,%courseprivs);
1792: my $is_cc;
1793: my ($js,$form,$switcher);
1794: my $ccrole;
1795: if ($crstype eq 'Community') {
1796: $ccrole = 'co';
1797: } else {
1798: $ccrole = 'cc';
1799: }
1800: my ($priv,$gotsymb,$destsymb);
1801: my $destinationurl = $ENV{'REQUEST_URI'};
1802: if ($destinationurl =~ /\?symb=/) {
1803: $gotsymb = 1;
1804: } elsif ($destinationurl =~ m{^/enc/}) {
1805: my $plainurl = &Apache::lonenc::unencrypted($destinationurl);
1806: if ($plainurl =~ /\?symb=/) {
1807: $gotsymb = 1;
1808: }
1809: }
1810: unless ($gotsymb) {
1811: $destsymb = &Apache::lonnet::symbread();
1812: if ($destsymb ne '') {
1813: $destsymb = &Apache::lonenc::check_encrypt($destsymb);
1814: }
1815: }
1816: my $reqprivs = &required_privs();
1817: if (ref($reqprivs) eq 'HASH') {
1818: my $destination = $destinationurl;
1819: $destination =~ s/(\?.*)$//;
1820: if (exists($reqprivs->{$destination})) {
1821: $priv = $reqprivs->{$destination};
1822: }
1823: }
1824: if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
1825: my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
1826:
1827: if ((($start) && ($start<0)) ||
1828: (($end) && ($end<$now)) ||
1829: (($start) && ($now<$start))) {
1830: $is_cc = 0;
1831: } else {
1832: $is_cc = 1;
1833: }
1834: }
1835: if ($is_cc) {
1836: &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$priv);
1837: } else {
1838: my %gotnosection;
1839: foreach my $item (keys(%env)) {
1840: if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
1841: my $role = $1;
1842: my $sec = $2;
1843: next if ($role eq 'gr');
1844: my ($start,$end) = split(/\./,$env{$item});
1845: next if (($start && $start > $now) || ($end && $end < $now));
1846: if ($sec eq '') {
1847: if (!$gotnosection{$role}) {
1848: $seccount{$role} ++;
1849: $gotnosection{$role} = 1;
1850: }
1851: }
1852: if ($priv ne '') {
1853: my $cnumsec = $cnum;
1854: if ($sec ne '') {
1855: $cnumsec .= "/$sec";
1856: }
1857: $courseprivs{"$role./$cdom/$cnumsec./"} =
1858: $env{"user.priv.$role./$cdom/$cnumsec./"};
1859: $courseprivs{"$role./$cdom/$cnumsec./$cdom/"} =
1860: $env{"user.priv.$role./$cdom/$cnumsec./$cdom/"};
1861: $courseprivs{"$role./$cdom/$cnumsec./$cdom/$cnumsec"} =
1862: $env{"user.priv.$role./$cdom/$cnumsec./$cdom/$cnumsec"};
1863: }
1864: if (ref($courseroles{$role}) eq 'ARRAY') {
1865: if ($sec ne '') {
1866: if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
1867: push(@{$courseroles{$role}},$sec);
1868: $seccount{$role} ++;
1869: }
1870: }
1871: } else {
1872: @{$courseroles{$role}} = ();
1873: if ($sec ne '') {
1874: $seccount{$role} ++;
1875: push(@{$courseroles{$role}},$sec);
1876: }
1877: }
1878: }
1879: }
1880: }
1881: my @roles_order = ($ccrole,'in','ta','ep','ad','st');
1882: my $numdiffsec;
1883: if (keys(%seccount) == 1) {
1884: foreach my $key (keys(%seccount)) {
1885: $numdiffsec = $seccount{$key};
1886: }
1887: }
1888: if ((keys(%seccount) > 1) || ($numdiffsec > 1)) {
1889: my @submenu;
1890: $js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$priv);
1891: $form =
1892: '<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles">'."\n".
1893: ' <input type="hidden" name="destinationurl" value="'.
1894: &HTML::Entities::encode($destinationurl).'" />'."\n".
1895: ' <input type="hidden" name="gotorole" value="1" />'."\n".
1896: ' <input type="hidden" name="selectrole" value="" />'."\n".
1897: ' <input type="hidden" name="switchrole" value="" />'."\n";
1898: if ($destsymb ne '') {
1899: $form .= ' <input type="hidden" name="destsymb" value="'.
1900: &HTML::Entities::encode($destsymb).'" />'."\n";
1901: }
1902: $form .= '</form>'."\n";
1903: foreach my $role (@roles_order) {
1904: my $include;
1905: if (defined($courseroles{$role})) {
1906: if ($env{'request.role'} =~ m{^\Q$role\E}) {
1907: if ($seccount{$role} > 1) {
1908: $include = 1;
1909: }
1910: } else {
1911: $include = 1;
1912: }
1913: }
1914: if ($include) {
1915: push(@submenu,['javascript:adhocRole('."'$role'".')',
1916: &Apache::lonnet::plaintext($role,$crstype)]);
1917: }
1918: }
1919: foreach my $role (sort(keys(%courseroles))) {
1920: if ($role =~ /^cr/) {
1921: my $include;
1922: if ($env{'request.role'} =~ m{^\Q$role\E}) {
1923: if ($seccount{$role} > 1) {
1924: $include = 1;
1925: }
1926: } else {
1927: $include = 1;
1928: }
1929: if ($include) {
1930: push(@submenu,['javascript:adhocRole('."'$role'".')',
1931: &Apache::lonnet::plaintext($role)]);
1932: }
1933: }
1934: }
1935: if (@submenu > 0) {
1936: $switcher = &create_submenu('','',&mt('Switch role'),\@submenu);
1937: }
1938: }
1939: return ($js,$form,$switcher);
1940: }
1941:
1942: sub get_all_courseroles {
1943: my ($cdom,$cnum,$courseroles,$seccount,$courseprivs) = @_;
1944: unless ((ref($courseroles) eq 'HASH') && (ref($seccount) eq 'HASH') &&
1945: (ref($courseprivs) eq 'HASH')) {
1946: return;
1947: }
1948: my ($result,$cached) =
1949: &Apache::lonnet::is_cached_new('getcourseroles',$cdom.'_'.$cnum);
1950: if (defined($cached)) {
1951: if (ref($result) eq 'HASH') {
1952: if ((ref($result->{'roles'}) eq 'HASH') &&
1953: (ref($result->{'seccount'}) eq 'HASH') &&
1954: (ref($result->{'privs'}) eq 'HASH')) {
1955: %{$courseroles} = %{$result->{'roles'}};
1956: %{$seccount} = %{$result->{'seccount'}};
1957: %{$courseprivs} = %{$result->{'privs'}};
1958: return;
1959: }
1960: }
1961: }
1962: my %gotnosection;
1963: my %adv_roles =
1964: &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1);
1965: foreach my $role (keys(%adv_roles)) {
1966: my ($urole,$usec) = split(/:/,$role);
1967: if (!$gotnosection{$urole}) {
1968: $seccount->{$urole} ++;
1969: $gotnosection{$urole} = 1;
1970: }
1971: if (ref($courseroles->{$urole}) eq 'ARRAY') {
1972: if ($usec ne '') {
1973: if (!grep(/^Q$usec\E$/,@{$courseroles->{$urole}})) {
1974: push(@{$courseroles->{$urole}},$usec);
1975: $seccount->{$urole} ++;
1976: }
1977: }
1978: } else {
1979: @{$courseroles->{$urole}} = ();
1980: if ($usec ne '') {
1981: $seccount->{$urole} ++;
1982: push(@{$courseroles->{$urole}},$usec);
1983: }
1984: }
1985: my $area = '/'.$cdom.'/'.$cnum;
1986: if ($usec ne '') {
1987: $area .= '/'.$usec;
1988: }
1989: if ($role =~ /^cr\//) {
1990: &Apache::lonnet::custom_roleprivs($courseprivs,$urole,$cdom,$cnum,$urole.'.'.$area,$area);
1991: } else {
1992: &Apache::lonnet::standard_roleprivs($courseprivs,$urole,$cdom,$urole.'.'.$area,$cnum,$area);
1993: }
1994: }
1995: my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum,['st']);
1996: @{$courseroles->{'st'}} = ();
1997: &Apache::lonnet::standard_roleprivs($courseprivs,'st',$cdom,"st./$cdom/$cnum",$cnum,"/$cdom/$cnum");
1998: if (keys(%sections_count) > 0) {
1999: push(@{$courseroles->{'st'}},keys(%sections_count));
2000: $seccount->{'st'} = scalar(keys(%sections_count));
2001: }
2002: $seccount->{'st'} ++; # Increment for a section-less student role.
2003: my $rolehash = {
2004: 'roles' => $courseroles,
2005: 'seccount' => $seccount,
2006: 'privs' => $courseprivs,
2007: };
2008: &Apache::lonnet::do_cache_new('getcourseroles',$cdom.'_'.$cnum,$rolehash);
2009: return;
2010: }
2011:
2012: sub jump_to_role {
2013: my ($cdom,$cnum,$seccount,$courseroles,$courseprivs,$priv) = @_;
2014: my %lt = &Apache::lonlocal::texthash(
2015: this => 'This role has section(s) associated with it.',
2016: ente => 'Enter a specific section.',
2017: orlb => 'Enter a specific section, or leave blank for no section.',
2018: avai => 'Available sections are:',
2019: youe => 'You entered an invalid section choice:',
2020: plst => 'Please try again.',
2021: role => 'The role you selected is not permitted to view the current page.',
2022: swit => 'Switch role, but display Main Menu page instead?',
2023: );
2024: my $js;
2025: if (ref($courseroles) eq 'HASH') {
2026: $js = ' var secpick = new Array("'.$lt{'ente'}.'","'.$lt{'orlb'}.'");'."\n".
2027: ' var numsec = new Array();'."\n".
2028: ' var rolesections = new Array();'."\n".
2029: ' var rolenames = new Array();'."\n".
2030: ' var roleseclist = new Array();'."\n";
2031: my @items = keys(%{$courseroles});
2032: for (my $i=0; $i<@items; $i++) {
2033: $js .= ' rolenames['.$i.'] = "'.$items[$i].'";'."\n";
2034: my ($secs,$secstr);
2035: if (ref($courseroles->{$items[$i]}) eq 'ARRAY') {
2036: my @sections = sort { $a <=> $b } @{$courseroles->{$items[$i]}};
2037: $secs = join('","',@sections);
2038: $secstr = join(', ',@sections);
2039: }
2040: $js .= ' rolesections['.$i.'] = new Array("'.$secs.'");'."\n".
2041: ' roleseclist['.$i.'] = "'.$secstr.'";'."\n".
2042: ' numsec['.$i.'] = "'.$seccount->{$items[$i]}.'";'."\n";
2043: }
2044: }
2045: my $checkroles = 0;
2046: if ($priv && ref($courseprivs) eq 'HASH') {
2047: my (%disallowed,%allowed,@disallow);
2048: foreach my $role (sort(keys(%{$courseprivs}))) {
2049: my $trole;
2050: if ($role =~ m{^(.+?)\Q./$cdom/$cnum\E}) {
2051: $trole = $1;
2052: }
2053: if (($trole ne '') && ($trole ne 'cm')) {
2054: if ($courseprivs->{$role} =~ /\Q:$priv\E($|:|\&\w+)/) {
2055: $allowed{$trole} = 1;
2056: } else {
2057: $disallowed{$trole} = 1;
2058: }
2059: }
2060: }
2061: foreach my $trole (keys(%disallowed)) {
2062: unless ($allowed{$trole}) {
2063: push(@disallow,$trole);
2064: }
2065: }
2066: if (@disallow > 0) {
2067: $checkroles = 1;
2068: $js .= " var disallow = new Array('".join("','",@disallow)."');\n".
2069: " var rolecheck = 1;\n";
2070: }
2071: }
2072: if (!$checkroles) {
2073: $js .= " var disallow = new Array();\n".
2074: " rolecheck = 0;\n";
2075: }
2076: return <<"END";
2077: <script type="text/javascript">
2078: //<![CDATA[
2079: function adhocRole(newrole) {
2080: $js
2081: if (newrole == '') {
2082: return;
2083: }
2084: var fullrole = newrole+'./$cdom/$cnum';
2085: var selidx = '';
2086: for (var i=0; i<rolenames.length; i++) {
2087: if (rolenames[i] == newrole) {
2088: selidx = i;
2089: }
2090: }
2091: if (rolecheck > 0) {
2092: for (var i=0; i<disallow.length; i++) {
2093: if (disallow[i] == newrole) {
2094: if (confirm("$lt{'role'}\\n$lt{'swit'}")) {
2095: document.rolechooser.destinationurl.value = '/adm/menu';
2096: } else {
2097: return;
2098: }
2099: }
2100: }
2101: }
2102: var secok = 1;
2103: var secchoice = '';
2104: if (selidx >= 0) {
2105: if (numsec[selidx] > 1) {
2106: secok = 0;
2107: var numrolesec = rolesections[selidx].length;
2108: var msgidx = numsec[selidx] - numrolesec;
2109: secchoice = prompt("$lt{'this'} "+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],"");
2110: if (secchoice == '') {
2111: if (msgidx > 0) {
2112: secok = 1;
2113: }
2114: } else {
2115: for (var j=0; j<rolesections[selidx].length; j++) {
2116: if (rolesections[selidx][j] == secchoice) {
2117: secok = 1;
2118: }
2119: }
2120: }
2121: } else {
2122: if (rolesections[selidx].length == 1) {
2123: secchoice = rolesections[selidx][0];
2124: }
2125: }
2126: }
2127: if (secok == 1) {
2128: if (secchoice != '') {
2129: fullrole += '/'+secchoice;
2130: }
2131: } else {
2132: if (secchoice != null) {
2133: alert("$lt{'youe'} \\""+secchoice+"\\".\\n $lt{'plst'}");
2134: }
2135: return;
2136: }
2137: if (fullrole == "$env{'request.role'}") {
2138: return;
2139: }
2140: itemid = retrieveIndex('gotorole');
2141: if (itemid != -1) {
2142: document.rolechooser.elements[itemid].name = fullrole;
2143: }
2144: document.rolechooser.switchrole.value = fullrole;
2145: document.rolechooser.selectrole.value = '1';
2146: document.rolechooser.submit();
2147: return;
2148: }
2149:
2150: function retrieveIndex(item) {
2151: for (var i=0;i<document.rolechooser.elements.length;i++) {
2152: if (document.rolechooser.elements[i].name == item) {
2153: return i;
2154: }
2155: }
2156: return -1;
2157: }
2158: // ]]>
2159: </script>
2160: END
2161: }
2162:
2163: sub required_privs {
2164: my $privs = {
2165: '/adm/parmset' => 'opa',
2166: '/adm/courseprefs' => 'opa',
2167: '/adm/whatsnew' => 'whn',
2168: '/adm/populate' => 'cst',
2169: '/adm/trackstudent' => 'vsa',
2170: '/adm/statistics' => 'vgr',
2171: '/adm/setblock' => 'dcm',
2172: '/adm/coursedocs' => 'mdc',
2173: };
2174: unless ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'spreadsheet') {
2175: $privs->{'/adm/classcalc'} = 'vgr',
2176: $privs->{'/adm/assesscalc'} = 'vgr',
2177: $privs->{'/adm/studentcalc'} = 'vgr';
2178: }
2179: return $privs;
2180: }
2181:
2182: sub countdown_timer {
2183: if (($env{'request.course.id'}) && ($env{'request.symb'} ne '') &&
2184: ($env{'request.filename'}=~/$LONCAPA::assess_re/)) {
2185: my ($type,$hastimeleft,$slothastime);
2186: my $now = time;
2187: if ($env{'request.filename'} =~ /\.task$/) {
2188: $type = 'Task';
2189: } else {
2190: $type = 'problem';
2191: }
2192: my ($status,$accessmsg,$slot_name,$slot) =
2193: &Apache::lonhomework::check_slot_access('0',$type);
2194: if ($slot_name ne '') {
2195: if (ref($slot) eq 'HASH') {
2196: if (($slot->{'starttime'} < $now) &&
2197: ($slot->{'endtime'} > $now)) {
2198: $slothastime = 1;
2199: }
2200: }
2201: }
2202: if ($status ne 'CAN_ANSWER') {
2203: return;
2204: }
2205: my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
2206: my @interval=&Apache::lonnet::EXT("resource.0.interval");
2207: if (@interval > 1) {
2208: my $first_access=&Apache::lonnet::get_first_access($interval[1]);
2209: if ($first_access > 0) {
2210: if ($first_access+$interval[0] > time) {
2211: $hastimeleft = 1;
2212: }
2213: }
2214: }
2215: if (($duedate && $duedate > time) ||
2216: (!$duedate && $hastimeleft) ||
2217: ($slot_name ne '' && $slothastime)) {
2218: my ($collapse,$expand,$alttxt,$title,$currdisp);
2219: if ((@interval > 1 && $hastimeleft) ||
2220: ($type eq 'Task' && $slothastime)) {
2221: $currdisp = 'inline';
2222: $collapse = '► ';
2223: } else {
2224: $currdisp = 'none';
2225: $expand = '◄ ';
2226: }
2227: unless ($env{'environment.icons'} eq 'iconsonly') {
2228: $alttxt = &mt('Timer');
2229: $title = $alttxt.' ';
2230: }
2231: my $desc = &mt('Countdown to due date/time');
2232: return <<END;
2233:
2234: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
2235: <span id="ddcountcollapse" class="LC_menubuttons_inline_text">
2236: $collapse
2237: </span></a>
2238: <span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;"></span>
2239: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
2240: <span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span>
2241: <img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a>
2242: END
2243: }
2244: }
2245: return;
2246: }
2247:
2248: # ================================================================ Main Program
2249:
2250: BEGIN {
2251: if (! defined($readdesk)) {
2252: {
2253: my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
2254: if ( CORE::open( my $config,"<$tabfile") ) {
2255: while (my $configline=<$config>) {
2256: $configline=(split(/\#/,$configline))[0];
2257: $configline=~s/^\s+//;
2258: chomp($configline);
2259: if ($configline=~/^cat\:/) {
2260: my @entries=split(/\:/,$configline);
2261: $category_positions{$entries[2]}=$entries[1];
2262: $category_names{$entries[2]}=$entries[3];
2263: } elsif ($configline=~/^prim\:/) {
2264: my @entries = (split(/\:/, $configline))[1..6];
2265: push(@primary_menu,\@entries);
2266: } elsif ($configline=~/^primsub\:/) {
2267: my ($parent,@entries) = (split(/\:/, $configline))[1..4];
2268: push(@{$primary_submenu{$parent}},\@entries);
2269: } elsif ($configline=~/^scnd\:/) {
2270: my @entries = (split(/\:/, $configline))[1..5];
2271: push(@secondary_menu,\@entries);
2272: } elsif ($configline) {
2273: push(@desklines,$configline);
2274: }
2275: }
2276: CORE::close($config);
2277: }
2278: }
2279: $readdesk='done';
2280: }
2281: }
2282:
2283: 1;
2284: __END__
2285:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>