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