Annotation of loncom/interface/lonmenu.pm, revision 1.218

1.1       www         1: # The LearningOnline Network with CAPA
                      2: # Routines to control the menu
                      3: #
1.218   ! www         4: # $Id: lonmenu.pm,v 1.217 2007/04/24 23:26:02 albertel 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.48      www        29: # There are two parameters controlling the action of this module:
                     30: #
                     31: # browser.interface - if this is 'textual', it overrides the second parameter
                     32: # and goes to screen reader PDA mode
                     33: #
                     34: # environment.remote - if this is 'on', the routines controll the remote
                     35: # control, otherwise they render the main window controls; ignored it
                     36: # browser.interface is 'textual'
1.1       www        37: #
                     38: 
                     39: package Apache::lonmenu;
                     40: 
                     41: use strict;
1.152     albertel   42: use Apache::lonnet;
1.47      matthew    43: use Apache::lonhtmlcommon();
1.115     albertel   44: use Apache::loncommon();
1.127     albertel   45: use Apache::lonenc();
1.88      www        46: use Apache::lonlocal;
1.207     foxr       47: use LONCAPA qw(:DEFAULT :match);
1.88      www        48: 
1.209     www        49: use vars qw(@desklines %category_names %category_members %category_positions $readdesk);
1.88      www        50: 
                     51: 
1.56      www        52: my @inlineremote;
1.38      www        53: 
1.203     foxr       54: 
                     55: 
1.88      www        56: # ================================================================ Little texts
                     57: 
                     58: sub initlittle {
                     59:     return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
                     60: 				       'nav' => 'Navigate Contents',
                     61: 				       'main' => 'Main Menu',
1.152     albertel   62:                                        'roles' => ($env{'user.adv'}?
1.149     www        63:                                                     'Roles':'Courses'),
1.151     www        64:                                        'docs' => 'Course Documents',
1.149     www        65:                                        'exit' => 'Exit',
1.202     albertel   66:                                        'login' => 'Log In',
1.165     raeburn    67: 				       'launch' => 'Launch Remote Control',
1.188     albertel   68:                                        'groups' => 'Groups',
1.184     raeburn    69:                                        'gdoc' => 'Group Documents',
                     70:                                        );
1.88      www        71: }
                     72: 
1.40      www        73: # ============================= This gets called at the top of the body section
1.38      www        74: 
                     75: sub menubuttons {
                     76:     my $forcereg=shift;
1.40      www        77:     my $registration=shift;
1.131     raeburn    78:     my $titletable=shift;
1.112     albertel   79:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                     80: 					    ['inhibitmenu']);
1.152     albertel   81:     if (($env{'form.inhibitmenu'} eq 'yes') ||
1.149     www        82:         ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
1.175     albertel   83: 
                     84:     if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
                     85: 
1.163     www        86:     my %lt=&initlittle();
1.55      www        87:     my $navmaps='';
1.59      www        88:     my $reloadlink='';
1.151     www        89:     my $docs='';
1.165     raeburn    90:     my $groups='';
                     91:     my $showgroups=0;
1.183     www        92:     my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
                     93:     my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
1.176     albertel   94: 
1.199     albertel   95:     my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
                     96:     $logo = '<td class="LC_top_nav_logo"><a href="/adm/about.html"><img src="'.
                     97: 	$logo.'" alt="LON-CAPA Logo" /></a></td>';
                     98: 
1.152     albertel   99:     if ($env{'request.state'} eq 'construct') {
                    100:         if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
                    101:             my $returnurl = $env{'request.filename'};
1.134     raeburn   102:             $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
1.183     www       103:             $escurl = &escape($returnurl);
1.134     raeburn   104:         }
                    105:     }
1.165     raeburn   106:     if ($env{'request.course.id'}) {
                    107:         my %coursegroups;
1.188     albertel  108:         my $viewgrps_permission =
1.197     raeburn   109: 	    &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
1.165     raeburn   110:         if (!$viewgrps_permission) {
                    111:             %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
1.188     albertel  112: 	}
1.165     raeburn   113:         if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
                    114:             $showgroups = 1;
                    115:         }
                    116:     }
                    117: 
1.152     albertel  118:     if ($env{'browser.interface'} eq 'textual') {
1.41      www       119: # Textual display only
1.152     albertel  120:         if ($env{'request.course.id'}) {
1.55      www       121: 	    $navmaps=(<<ENDNAV);
1.181     albertel  122: <a href="/adm/navmaps?postdata=$escurl&amp;postsymb=$escsymb" target="_top">$lt{'nav'}</a>
1.55      www       123: ENDNAV
1.152     albertel  124:             if (($env{'request.noversionuri'}=~/^\/adm\//) &&
                    125:          ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
1.193     raeburn   126:          ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
1.183     www       127:                 my $escreload=&escape('return:');
1.59      www       128:                 $reloadlink=(<<ENDRELOAD);
1.176     albertel  129: <a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>
1.59      www       130: ENDRELOAD
                    131:             }
1.152     albertel  132: 	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
1.151     www       133:                $docs=(<<ENDDOCS);
1.176     albertel  134: <a href="/adm/coursedocs" target="_top">$lt{'docs'}</a>
1.151     www       135: ENDDOCS
                    136:             }
1.197     raeburn   137:             if ($showgroups) {
                    138:                 $groups =(<<ENDGROUPS);
                    139: <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a>
                    140: ENDGROUPS
                    141:             }
1.194     banghart  142: 	}
1.130     albertel  143:         my $form=&serverform();
1.116     albertel  144:         my $utility=&utilityfunctions();
1.48      www       145: 	my $output=(<<ENDMAINMENU);
1.129     albertel  146: <script type="text/javascript">
1.150     albertel  147: // BEGIN LON-CAPA Internal
1.116     albertel  148: $utility
1.44      www       149: </script>
1.176     albertel  150: <div id="LC_top_nav">
1.88      www       151: <a href="/adm/menu" target="_top">$lt{'main'}</a>
1.165     raeburn   152: $reloadlink $navmaps $docs $groups
1.176     albertel  153: <a href="/adm/roles" target="_top">$lt{'roles'}</a>
                    154: <a href="/adm/logout" target="_top">$lt{'exit'}</a>
                    155: </div>
1.149     www       156: <br />
1.129     albertel  157: <script type="text/javascript">
1.44      www       158: // END LON-CAPA Internal
                    159: </script>
1.130     albertel  160: $form
1.44      www       161: ENDMAINMENU
1.173     albertel  162:         if ($registration) { $output.=&innerregister($forcereg); }
1.48      www       163: 	return $output."<hr />";
1.152     albertel  164:     } elsif ($env{'environment.remote'} eq 'off') {
1.48      www       165: # Remote Control is switched off
1.58      www       166: # figure out colors
1.88      www       167: 	my %lt=&initlittle();
1.172     albertel  168: 
1.58      www       169:         my $domain=&Apache::loncommon::determinedomain();
1.172     albertel  170: 	my $function =&Apache::loncommon::get_users_function();
1.58      www       171:         my $link=&Apache::loncommon::designparm($function.'.link',$domain);
                    172:         my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
                    173:         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
                    174:         my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
1.156     albertel  175: 	if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
                    176: 	    return (<<ENDINLINEMENU);
1.176     albertel  177:    <table id="LC_top_nav">
1.156     albertel  178:     <tr>
1.199     albertel  179:       $logo
                    180:       <td></td>
1.202     albertel  181:       <td class="LC_top_nav_login">
                    182:         <a href="/adm/roles" target="_top">$lt{'login'}</a>
1.156     albertel  183:      </td>
1.189     albertel  184:     </tr>
1.156     albertel  185:   </table>
                    186: </font>
                    187: ENDINLINEMENU
                    188:         }
1.58      www       189: # Do we have a NAV link?
1.152     albertel  190:         if ($env{'request.course.id'}) {
1.141     albertel  191: 	    my $link='/adm/navmaps?postdata='.$escurl.'&amp;postsymb='.
                    192: 		$escsymb;
1.152     albertel  193: 	    if ($env{'environment.remotenavmap'} eq 'on') {
1.141     albertel  194: 		$link="javascript:gonav('".$link."')";
                    195: 	    }
                    196: 	    $navmaps=(<<ENDNAV);
1.176     albertel  197: <td><a href="$link" target="_top">$lt{'nav'}</a></td>
1.114     albertel  198: ENDNAV
1.186     albertel  199: my $is_group = (&Apache::loncommon::course_type() eq 'Group');
1.152     albertel  200: 	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
1.186     albertel  201:                 my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
1.151     www       202: 		$docs=(<<ENDDOCS);
1.184     raeburn   203: <td><a href="/adm/coursedocs" target="_top">$text</a></td>
1.151     www       204: ENDDOCS
                    205:             }
1.197     raeburn   206:             if ($showgroups) {
                    207:                 $groups =(<<ENDGROUPS);
                    208: <td><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>
                    209: ENDGROUPS
                    210:             }
1.144     albertel  211: 	    if (
1.152     albertel  212: 		($env{'request.noversionuri'}=~m[^/(res|public)/] &&
                    213: 		 $env{'request.symb'} eq '')
1.144     albertel  214: 		||
1.152     albertel  215: 		(($env{'request.noversionuri'}=~/^\/adm\//) &&
                    216: 		 ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
                    217: 		 ($env{'request.noversionuri'}!~
1.193     raeburn   218: 		        m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
1.144     albertel  219: 		  )
                    220: 		 ) {
1.183     www       221:                 my $escreload=&escape('return:');
1.59      www       222:                 $reloadlink=(<<ENDRELOAD);
1.176     albertel  223: <td><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></td>
1.59      www       224: ENDRELOAD
                    225:             }
1.55      www       226:         }
1.163     www       227: 	if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
1.183     www       228: 	    my $escreload=&escape('return:');
1.163     www       229: 	    $reloadlink=(<<ENDCRELOAD);
1.176     albertel  230: <td><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></td>
1.163     www       231: ENDCRELOAD
                    232:         }
1.58      www       233:         my $reg='';
                    234:         if ($registration) {
1.173     albertel  235:            $reg=&innerregister($forcereg,$titletable);
1.58      www       236:         }
1.130     albertel  237:         my $form=&serverform();
1.116     albertel  238: 	my $utility=&utilityfunctions();
1.179     albertel  239: 	my $remote;
                    240: 	if ($env{'user.adv'}) {
1.181     albertel  241: 	    $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'
1.179     albertel  242: 	}
1.198     albertel  243: 
                    244:         my $helplink=&Apache::loncommon::top_nav_help('Help');
1.58      www       245: 	return (<<ENDINLINEMENU);
1.129     albertel  246: <script type="text/javascript">
1.150     albertel  247: // BEGIN LON-CAPA Internal
                    248: // <![CDATA[
1.116     albertel  249: $utility
1.150     albertel  250: // ]]>
1.48      www       251: </script>
1.176     albertel  252: <table id="LC_top_nav">
1.58      www       253: <tr>
1.199     albertel  254: $logo
1.176     albertel  255: <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>
1.59      www       256: $reloadlink
1.55      www       257: $navmaps
1.151     www       258: $docs
1.165     raeburn   259: $groups
1.179     albertel  260: $remote
1.176     albertel  261: <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>
1.199     albertel  262: <td class="LC_top_nav_help">$helplink</td>
                    263: <td class="LC_top_nav_exit"><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>
1.58      www       264: </tr>
                    265: </table>
1.168     albertel  266: $form
1.129     albertel  267: <script type="text/javascript">
1.48      www       268: // END LON-CAPA Internal
                    269: </script>
1.58      www       270: $reg
1.48      www       271: ENDINLINEMENU
                    272:     } else {
                    273: 	return '';
                    274:     }
1.72      www       275: }
                    276: 
1.40      www       277: # ====================================== This gets called in the header section
1.38      www       278: 
                    279: sub registerurl {
1.173     albertel  280:     my ($forcereg) = @_;
1.38      www       281:     my $result = '';
1.175     albertel  282:     if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.66      albertel  283:     my $force_title='';
1.152     albertel  284:     if ($env{'request.state'} eq 'construct') {
1.66      albertel  285: 	$force_title=&Apache::lonxml::display_title();
                    286:     }
1.152     albertel  287:     if (($env{'browser.interface'} eq 'textual') ||
                    288:         ($env{'environment.remote'} eq 'off') ||
                    289:         ((($env{'request.publicaccess'}) || 
1.83      www       290:          (!&Apache::lonnet::is_on_map(
1.183     www       291: 	   &unescape($env{'request.noversionuri'})))) &&
1.38      www       292:         (!$forcereg))) {
1.76      www       293:  	return $result.
                    294:           '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title;
1.38      www       295:     }
1.41      www       296: # Graphical display after login only
1.174     albertel  297:     if ($env{'request.registered'} && !$forcereg) { return ''; }
1.173     albertel  298:     $result.=&innerregister($forcereg);
1.66      albertel  299:     return $result.$force_title;
1.40      www       300: }
                    301: 
                    302: # =========== This gets called in order to register a URL, both with the Remote
                    303: # =========== and in the body of the document
                    304: 
                    305: sub innerregister {
1.173     albertel  306:     my ($forcereg, $titletable) = @_;
1.40      www       307:     my $result = '';
1.120     raeburn   308:     my ($uname,$thisdisfn);
1.152     albertel  309:     my $const_space = ($env{'request.state'} eq 'construct');
1.131     raeburn   310:     my $is_const_dir = 0;
1.120     raeburn   311: 
1.175     albertel  312:     if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.40      www       313: 
1.174     albertel  314:     $env{'request.registered'} = 1;
1.40      www       315: 
1.152     albertel  316:     my $textinter=($env{'browser.interface'} eq 'textual');
                    317:     my $noremote=($env{'environment.remote'} eq 'off');
1.49      www       318:     
                    319:     my $textual=($textinter || $noremote);
                    320: 
1.177     albertel  321:     undef(@inlineremote);
1.56      www       322: 
1.38      www       323:     my $reopen=&Apache::lonmenu::reopenmenu();
1.40      www       324: 
1.38      www       325:     my $newmail='';
1.65      www       326:     if ($noremote) {
1.177     albertel  327: 	$newmail='<table id="LC_nav_location"><tr>';
1.65      www       328:     }
1.177     albertel  329:     if (&Apache::lonmsg::newmail()) { 
                    330: 	if ($textual) {
                    331: 	    $newmail.= '<td class="LC_new_mail">
                    332:                    <a href="/adm/communicate" target="_top">'.
                    333: 		   &mt('You have new messages').'</a></td>';
                    334: 	} else {
                    335: 	    $newmail= 'swmenu.setstatus("you have","messages");';
                    336: 	}
                    337:     } elsif (($textual) 
                    338: 	     && ($env{'request.symb'}) 
                    339: 	     && ($env{'request.course.id'})) {
                    340: 	$newmail.= '<td class="LC_current_location">';
1.153     albertel  341: 	my ($mapurl,$rid,$resurl)=
                    342: 	    &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
1.152     albertel  343:         $newmail.=$env{'course.'.$env{'request.course.id'}.'.description'};
1.61      www       344:         my $maptitle=&Apache::lonnet::gettitle($mapurl);
1.153     albertel  345: 	my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());
1.133     albertel  346:         if ($maptitle && $maptitle ne 'default.sequence') {
1.61      www       347: 	    $newmail.=', '.$maptitle;
                    348:         }
                    349:         if ($restitle) {
                    350: 	    $newmail.=': '.$restitle;
                    351:         }
1.177     albertel  352:         $newmail.='&nbsp;&nbsp;&nbsp;</td>';
1.65      www       353:     }
1.152     albertel  354:     if ($env{'request.state'} eq 'construct') {
1.131     raeburn   355:         $newmail = $titletable;
1.150     albertel  356:     } else {
                    357: 	if ($noremote) {
1.181     albertel  358: 	    $newmail.='</tr></table>';
1.150     albertel  359: 	}
1.38      www       360:     }
1.40      www       361:     my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
1.177     albertel  362:     my $tablestart=($noremote?'<table id="LC_menubuttons">':'').
                    363: 	($textinter?'<br /><a href="#content">'.&mt('Skip to Content').'</a><br />':'');
                    364:     my $tableend=($noremote?'</table>':'').($textinter?'<a name="content" />':'');
1.41      www       365: # =============================================================================
                    366: # ============================ This is for URLs that actually can be registered
1.152     albertel  367:     if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
1.40      www       368: # -- This applies to homework problems for users with grading privileges
1.152     albertel  369: 	my $crs='/'.$env{'request.course.id'};
                    370: 	if ($env{'request.course.sec'}) {
                    371: 	    $crs.='_'.$env{'request.course.sec'};
1.107     albertel  372: 	}
                    373: 	$crs=~s/\_/\//g;
                    374: 
1.38      www       375:         my $hwkadd='';
1.152     albertel  376:         if ($env{'request.symb'} ne '' &&
1.161     albertel  377: 	    $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
1.79      www       378: 	    if (&Apache::lonnet::allowed('mgr',$crs)) {
1.106     www       379: 		$hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_3]',
1.40      www       380:                        "gocmd('/adm/grades','gradingmenu')",
                    381:                        'Modify user grades for this assessment resource');
1.154     www       382:             } elsif (&Apache::lonnet::allowed('vgr',$crs)) {
                    383: 		$hwkadd.=&switch('','',7,2,'subm.gif','view sub-[_1]','missions[_1]',
                    384:                        "gocmd('/adm/grades','submission')",
                    385: 		       'View user submissions for this assessment resource');
1.38      www       386:             }
1.107     albertel  387: 	}
1.152     albertel  388: 	if ($env{'request.symb'} ne '' &&
1.145     albertel  389: 	    &Apache::lonnet::allowed('opa',$crs)) {
1.107     albertel  390: 	    $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
                    391: 			     "gocmd('/adm/parmset','set')",
1.196     www       392: 			     'Modify parameter settings for this resource');
1.38      www       393: 	}
1.40      www       394: # -- End Homework
1.38      www       395:         ###
                    396:         ### Determine whether or not to display the 'cstr' button for this
                    397:         ### resource
                    398:         ###
                    399:         my $editbutton = '';
1.152     albertel  400:         if ($env{'user.author'}) {
                    401:             if ($env{'request.role'}=~/^(ca|au)/) {
1.38      www       402:                 # Set defaults for authors
                    403:                 my ($top,$bottom) = ('con-','struct');
1.152     albertel  404:                 my $action = "go('/priv/".$env{'user.name'}."');";
                    405:                 my $cadom  = $env{'request.role.domain'};
                    406:                 my $caname = $env{'user.name'};
1.38      www       407:                 my $desc = "Enter my resource construction space";
                    408:                 # Set defaults for co-authors
1.152     albertel  409:                 if ($env{'request.role'} =~ /^ca/) { 
1.206     albertel  410:                     ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
1.38      www       411:                     ($top,$bottom) = ('co con-','struct');
                    412:                     $action = "go('/priv/".$caname."');";
                    413:                     $desc = "Enter construction space as co-author";
                    414:                 }
                    415:                 # Check that we are on the correct machine
                    416:                 my $home = &Apache::lonnet::homeserver($caname,$cadom);
1.109     albertel  417: 		my $allowed=0;
                    418: 		my @ids=&Apache::lonnet::current_machine_ids();
                    419: 		foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
                    420: 		if (!$allowed) {
                    421: 		    $editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc);
1.38      www       422:                 }
                    423:             }
                    424:             ##
                    425:             ## Determine if user can edit url.
                    426:             ##
                    427:             my $cfile='';
                    428:             my $cfuname='';
                    429:             my $cfudom='';
1.152     albertel  430:             if ($env{'request.filename'}) {
                    431:                 my $file=&Apache::lonnet::declutter($env{'request.filename'});
1.206     albertel  432:                 $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
1.109     albertel  433:                 # Check that the user has permission to edit this resource
1.38      www       434:                 ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
                    435:                 if (defined($cfudom)) {
1.109     albertel  436: 		    my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
                    437: 		    my $allowed=0;
                    438: 		    my @ids=&Apache::lonnet::current_machine_ids();
                    439: 		    foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
                    440: 		    if ($allowed) {
1.38      www       441:                         $cfile=$file;
                    442:                     }
                    443:                 }
                    444:             }        
                    445:             # Finally, turn the button on or off
1.120     raeburn   446:             if ($cfile && !$const_space) {
1.40      www       447:                 $editbutton=&switch
1.212     www       448:                     ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
1.38      www       449:                      "go('".$cfile."');","Edit this resource");
                    450:             } elsif ($editbutton eq '') {
1.191     www       451:                 $editbutton=&clear(6,1);
1.38      www       452:             }
                    453:         }
                    454:         ###
                    455:         ###
1.41      www       456: # Prepare the rest of the buttons
1.120     raeburn   457:         my $menuitems;
                    458:         if ($const_space) {
1.128     albertel  459: 	    my ($uname,$thisdisfn) =
1.152     albertel  460: 		($env{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
1.121     raeburn   461:             my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
1.131     raeburn   462:             if ($currdir =~ m-/$-) {
                    463:                 $is_const_dir = 1;
                    464:             } else {
                    465:                 $currdir =~ s#[^/]+$##;
1.200     foxr      466: 		my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
1.208     albertel  467: 		my $esc_currdir = &Apache::loncommon::escape_single($currdir);
1.131     raeburn   468:                 $menuitems=(<<ENDMENUITEMS);
1.208     albertel  469: s&6&1&list.gif&list[_1]&dir[_1]&golist('$esc_currdir')&List current directory
1.200     foxr      470: s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$cleandisfn')&Retrieve old version
                    471: s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$cleandisfn')&Publish this resource
                    472: s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$cleandisfn')&Delete this resource
                    473: s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document
1.120     raeburn   474: ENDMENUITEMS
1.131     raeburn   475:             }
1.203     foxr      476:         } elsif ( defined($env{'request.course.id'}) && 
                    477: 		 $env{'request.symb'} ne '' ) {
1.120     raeburn   478: 	    $menuitems=(<<ENDMENUITEMS);
1.41      www       479: c&3&1
1.209     www       480: s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&&1
                    481: 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       482: c&6&3
                    483: c&8&1
                    484: c&8&2
1.106     www       485: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
1.209     www       486: s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
                    487: s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1
1.41      www       488: ENDMENUITEMS
1.216     albertel  489: 
1.193     raeburn   490:             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
1.216     albertel  491: 		if (!$env{'request.enc'}) {
                    492: 		    $menuitems.=(<<ENDREALRES);
                    493: s&6&3&catalog.gif&catalog[_1]&info[_1]&catalog_info()&Show catalog information
                    494: ENDREALRES
                    495:                 }
1.120     raeburn   496: 	        $menuitems.=(<<ENDREALRES);
1.106     www       497: s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource
                    498: 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       499: ENDREALRES
1.120     raeburn   500: 	    }
                    501:         }
1.203     foxr      502: 	if ($env{'request.uri'} =~ /^\/res/) {
                    503: 	    $menuitems .= (<<ENDMENUITEMS);
                    504: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
                    505: ENDMENUITEMS
                    506: 	}
1.41      www       507:         my $buttons='';
                    508:         foreach (split(/\n/,$menuitems)) {
                    509: 	    my ($command,@rest)=split(/\&/,$_);
                    510:             if ($command eq 's') {
                    511: 		$buttons.=&switch('','',@rest);
                    512:             } else {
                    513:                 $buttons.=&clear(@rest);
                    514:             }
                    515:         }
1.148     albertel  516: 
                    517:         if ($textual) {
                    518: 	    my $addremote=0;
                    519: 	    foreach (@inlineremote) { if ($_ ne '') { $addremote=1; } }
                    520: 	    my $inlinebuttons='';
                    521: 	    if ($addremote) {
1.41      www       522: # Registered, textual output
1.103     www       523: 
1.152     albertel  524: 		if ($env{'browser.interface'} eq 'textual') {
1.148     albertel  525: 		    $inlinebuttons=
1.56      www       526:                         join('',map { (defined($_)?$_:'') } @inlineremote);
1.148     albertel  527: 		} else {
1.218   ! www       528:                     if ($env{'environment.icons'} eq 'iconsonly') {
        !           529:                        $inlinebuttons=(<<ENDINLINEICONS);
        !           530: <tr><td>
        !           531: $inlineremote[21] $inlineremote[23]
        !           532: $inlineremote[61] $inlineremote[63]
        !           533: $inlineremote[71] $inlineremote[72] $inlineremote[73]
        !           534: $inlineremote[81] $inlineremote[82] $inlineremote[83]
        !           535: $inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>
        !           536: ENDINLINEICONS
        !           537:                     } else {
        !           538: 		       $inlinebuttons=(<<ENDINLINE);
1.129     albertel  539: <tr><td>$inlineremote[21]</td><td>&nbsp;</td><td>$inlineremote[23]</td></tr>
1.103     www       540: <tr><td>$inlineremote[61]</td><td>$inlineremote[62]</td><td>$inlineremote[63]</td></tr>
                    541: <tr><td>$inlineremote[71]</td><td>$inlineremote[72]</td><td>$inlineremote[73]</td></tr>
                    542: <tr><td>$inlineremote[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr>
                    543: <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>
                    544: ENDINLINE
1.218   ! www       545:                     }
1.148     albertel  546:                 }
1.103     www       547: 	    }
1.41      www       548: 	    $result =(<<ENDREGTEXT);
1.129     albertel  549: <script type="text/javascript">
1.42      www       550: // BEGIN LON-CAPA Internal
                    551: </script>
1.41      www       552: $timesync
                    553: $newmail
1.58      www       554: $tablestart
1.56      www       555: $inlinebuttons
1.58      www       556: $tableend
1.129     albertel  557: <script type="text/javascript">
1.64      www       558: // END LON-CAPA Internal
1.42      www       559: </script>
                    560: 
1.41      www       561: ENDREGTEXT
                    562: # Registered, graphical output
                    563:         } else {
1.152     albertel  564: 	    my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1.183     www       565: 	    $requri=&Apache::lonenc::check_encrypt(&unescape($requri));
1.152     albertel  566: 	    my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1.113     albertel  567: 	    my $navstatus=&get_nav_status();
1.140     albertel  568: 	    my $clearcstr;
1.148     albertel  569: 
1.152     albertel  570: 	    if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
1.41      www       571: 	    $result = (<<ENDREGTHIS);
1.38      www       572:      
1.129     albertel  573: <script type="text/javascript">
1.150     albertel  574: // BEGIN LON-CAPA Internal
1.42      www       575: var swmenu=null;
1.38      www       576: 
                    577:     function LONCAPAreg() {
                    578: 	  swmenu=$reopen;
                    579:           swmenu.clearTimeout(swmenu.menucltim);
                    580:           $timesync
                    581:           $newmail
1.41      www       582:           $buttons
1.84      www       583: 	  swmenu.currentURL="$requri";
1.85      www       584:           swmenu.reloadURL=swmenu.currentURL+window.location.search;
1.125     albertel  585:           swmenu.currentSymb="$cursymb";
                    586:           swmenu.reloadSymb="$cursymb";
1.38      www       587:           swmenu.currentStale=0;
1.113     albertel  588: 	  $navstatus
1.38      www       589:           $hwkadd
                    590:           $editbutton
                    591:     }
                    592: 
                    593:     function LONCAPAstale() {
                    594: 	  swmenu=$reopen
                    595:           swmenu.currentStale=1;
                    596:           if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 
                    597:              swmenu.switchbutton
                    598:              (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
                    599: 	  }
                    600:           swmenu.clearbut(7,2);
                    601:           swmenu.clearbut(7,3);
                    602:           swmenu.menucltim=swmenu.setTimeout(
                    603:  'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
1.140     albertel  604:  'clearbut(9,1);clearbut(9,3);clearbut(6,3);$clearcstr',
1.38      www       605: 			  2000);
                    606:       }
                    607: 
1.150     albertel  608: // END LON-CAPA Internal 
1.38      www       609: </script>
                    610: ENDREGTHIS
1.41      www       611:         }
                    612: # =============================================================================
1.38      www       613:     } else {
1.41      www       614: # ========================================== This can or will not be registered
                    615:         if ($textual) {
                    616: # Not registered, textual
                    617: 	    $result= (<<ENDDONOTREGTEXT);
                    618: ENDDONOTREGTEXT
                    619:         } else {
                    620: # Not registered, graphical
                    621:            $result = (<<ENDDONOTREGTHIS);
1.38      www       622: 
1.129     albertel  623: <script type="text/javascript">
1.38      www       624: // BEGIN LON-CAPA Internal
1.42      www       625: var swmenu=null;
1.38      www       626: 
                    627:     function LONCAPAreg() {
                    628: 	  swmenu=$reopen
                    629:           $timesync
                    630:           swmenu.currentStale=1;
                    631:           swmenu.clearbut(2,1);
                    632:           swmenu.clearbut(2,3);
                    633:           swmenu.clearbut(8,1);
                    634:           swmenu.clearbut(8,2);
                    635:           swmenu.clearbut(8,3);
                    636:           if (swmenu.currentURL) {
                    637:              swmenu.switchbutton
                    638:               (3,1,'reload.gif','return','location','go(currentURL)');
                    639:  	  } else {
                    640: 	      swmenu.clearbut(3,1);
                    641:           }
                    642:     }
                    643: 
                    644:     function LONCAPAstale() {
                    645:     }
                    646: 
                    647: // END LON-CAPA Internal
                    648: </script>
                    649: ENDDONOTREGTHIS
1.41      www       650:        }
                    651: # =============================================================================
1.38      www       652:     }
                    653:     return $result;
                    654: }
                    655: 
                    656: sub loadevents() {
1.152     albertel  657:     if ($env{'request.state'} eq 'construct' ||
1.175     albertel  658: 	$env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.38      www       659:     return 'LONCAPAreg();';
                    660: }
                    661: 
                    662: sub unloadevents() {
1.152     albertel  663:     if ($env{'request.state'} eq 'construct' ||
1.175     albertel  664: 	$env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
1.38      www       665:     return 'LONCAPAstale();';
                    666: }
1.30      www       667: 
1.32      www       668: # ============================================================= Start up remote
                    669: 
                    670: sub startupremote {
                    671:     my ($lowerurl)=@_;
1.152     albertel  672:     if (($env{'browser.interface'} eq 'textual') ||
                    673:         ($env{'environment.remote'} eq 'off')) {
1.34      www       674:      return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
                    675:     }
1.49      www       676: #
                    677: # The Remote actually gets launched!
                    678: #
1.32      www       679:     my $configmenu=&rawconfig();
1.183     www       680:     my $esclowerurl=&escape($lowerurl);
1.119     www       681:     my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
1.32      www       682:     return(<<ENDREMOTESTARTUP);
1.129     albertel  683: <script type="text/javascript">
1.118     albertel  684: var timestart;
1.35      www       685: function wheelswitch() {
1.118     albertel  686:     if (typeof(document.wheel) != 'undefined') {
                    687: 	if (typeof(document.wheel.spin) != 'undefined') {
                    688: 	    var date=new Date();
                    689: 	    var waited=Math.round(30-((date.getTime()-timestart)/1000));
                    690: 	    document.wheel.spin.value=$message;
                    691: 	}
                    692:     }
1.35      www       693:    if (window.status=='|') { 
                    694:       window.status='/'; 
                    695:    } else {
                    696:       if (window.status=='/') {
                    697:          window.status='-';
                    698:       } else {
                    699:          if (window.status=='-') { 
                    700:             window.status='\\\\'; 
                    701:          } else {
                    702:             if (window.status=='\\\\') { window.status='|'; }
                    703:          }
                    704:       }
                    705:    } 
                    706: }
                    707: 
1.32      www       708: // ---------------------------------------------------------- The wait function
                    709: var canceltim;
                    710: function wait() {
                    711:    if ((menuloaded==1) || (tim==1)) {
1.35      www       712:       window.status='Done.';
1.32      www       713:       if (tim==0) {
                    714:          clearTimeout(canceltim);
                    715:          $configmenu
                    716:          window.location='$lowerurl';  
                    717:       } else {
1.52      www       718: 	  window.location='/adm/remote?action=collapse&url=$esclowerurl';
1.32      www       719:       }
                    720:    } else {
1.35      www       721:       wheelswitch();
                    722:       setTimeout('wait();',200);
1.32      www       723:    }
                    724: }
                    725: 
                    726: function main() {
1.52      www       727:    canceltim=setTimeout('tim=1;',30000);
1.35      www       728:    window.status='-';
1.118     albertel  729:    var date=new Date();
                    730:    timestart=date.getTime();
1.32      www       731:    wait();
                    732: }
                    733: 
                    734: </script>
                    735: ENDREMOTESTARTUP
                    736: }
                    737: 
                    738: sub setflags() {
                    739:     return(<<ENDSETFLAGS);
1.129     albertel  740: <script type="text/javascript">
1.32      www       741:     menuloaded=0;
                    742:     tim=0;
                    743: </script>
                    744: ENDSETFLAGS
                    745: }
                    746: 
                    747: sub maincall() {
1.152     albertel  748:     if (($env{'browser.interface'} eq 'textual') ||
                    749:         ($env{'environment.remote'} eq 'off')) { return ''; }
1.32      www       750:     return(<<ENDMAINCALL);
1.129     albertel  751: <script type="text/javascript">
1.32      www       752:     main();
                    753: </script>
                    754: ENDMAINCALL
                    755: }
1.118     albertel  756: 
                    757: sub load_remote_msg {
                    758:     my ($lowerurl)=@_;
                    759: 
1.152     albertel  760:     if (($env{'browser.interface'} eq 'textual') ||
                    761:         ($env{'environment.remote'} eq 'off')) { return ''; }
1.118     albertel  762: 
1.183     www       763:     my $esclowerurl=&escape($lowerurl);
1.119     www       764:     my $link=&mt('<a href="[_1]">Continue</a> on in Inline Menu mode',
1.182     albertel  765: 		 "/adm/remote?action=collapse&amp;url=$esclowerurl");
1.118     albertel  766:     return(<<ENDREMOTEFORM);
                    767: <p>
                    768: <form name="wheel">
1.119     www       769: <input name="spin" type="text" size="60" />
1.118     albertel  770: </form>
                    771: </p>
                    772: <p>$link</p>
                    773: ENDREMOTEFORM
                    774: }
1.30      www       775: # ================================================================= Reopen menu
                    776: 
                    777: sub reopenmenu {
1.152     albertel  778:    if (($env{'browser.interface'} eq 'textual') ||
                    779:        ($env{'environment.remote'} eq 'off')) { return ''; }
1.30      www       780:    my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.47      matthew   781:    my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
                    782:    return('window.open('.$nothing.',"'.$menuname.'","",false);');
1.30      www       783: } 
                    784: 
1.1       www       785: # =============================================================== Open the menu
                    786: 
                    787: sub open {
1.22      www       788:     my $returnval='';
1.152     albertel  789:     if (($env{'browser.interface'} eq 'textual') ||
                    790:         ($env{'environment.remote'} eq 'off')) { 
1.111     albertel  791: 	return '<script type="text/javascript">self.name="loncapaclient";</script>';
                    792:     }
1.30      www       793:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.22      www       794:     unless (shift eq 'unix') {
                    795: # resizing does not work on linux because of virtual desktop sizes
                    796:        $returnval.=(<<ENDRESIZE);
                    797: if (window.screen) {
1.28      www       798:     self.resizeTo(screen.availWidth-215,screen.availHeight-55);
1.22      www       799:     self.moveTo(190,15);
                    800: }
                    801: ENDRESIZE
                    802:     }
                    803:     $returnval.=(<<ENDOPEN);
1.35      www       804: window.status='Opening LON-CAPA Remote Control';
1.30      www       805: var menu=window.open("/res/adm/pages/menu.html","$menuname",
1.191     www       806: "height=375,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
1.71      www       807: self.name='loncapaclient';
1.1       www       808: ENDOPEN
1.129     albertel  809:     return '<script type="text/javascript">'.$returnval.'</script>';
1.1       www       810: }
                    811: 
1.2       www       812: 
                    813: # ================================================================== Raw Config
                    814: 
1.3       www       815: sub clear {
                    816:     my ($row,$col)=@_;
1.152     albertel  817:     unless (($env{'browser.interface'} eq 'textual') ||
                    818:             ($env{'environment.remote'} eq 'off')) {
1.35      www       819:        return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
1.56      www       820:    } else { 
                    821:        $inlineremote[10*$row+$col]='';
                    822:        return ''; 
                    823:    }
1.3       www       824: }
                    825: 
1.40      www       826: # ============================================ Switch a button or create a link
1.25      matthew   827: # Switch acts on the javascript that is executed when a button is clicked.  
                    828: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
1.40      www       829: 
1.2       www       830: sub switch {
1.209     www       831:     my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_;
1.2       www       832:     $act=~s/\$uname/$uname/g;
                    833:     $act=~s/\$udom/$udom/g;
1.88      www       834:     $top=&mt($top);
                    835:     $bot=&mt($bot);
                    836:     $desc=&mt($desc);
1.105     www       837:     $img=&mt($img);
1.172     albertel  838: 
1.209     www       839:     my $idx=10*$row+$col;
                    840:     $category_members{$cat}.=':'.$idx;
                    841: 
1.152     albertel  842:     unless (($env{'browser.interface'} eq 'textual')  ||
                    843:             ($env{'environment.remote'} eq 'off')) {
1.50      www       844: # Remote
1.34      www       845:        return "\n".
1.35      www       846:  qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
1.152     albertel  847:    } elsif ($env{'browser.interface'} eq 'textual') {
1.50      www       848: # Accessibility
                    849:        if ($nobreak==2) { return ''; }
                    850:        my $text=$top.' '.$bot;
1.78      www       851:        $text=~s/\s*\-\s*//gs;
1.94      www       852:        if ($nobreak) {
1.209     www       853: 	   $inlineremote[$idx]=
1.94      www       854: 	       '<a href="javascript:'.$act.';">'.$text.'</a>';
                    855:        } else {
1.209     www       856: 	   $inlineremote[$idx]="\n<br />".
1.100     www       857: 	       $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';
1.94      www       858:        }
1.34      www       859:    } else {
1.50      www       860: # Inline Remote
1.213     www       861:        if ($env{'environment.icons'} ne 'classic') {
                    862:           $img=~s/\.gif$/\.png/;
                    863:        }
1.41      www       864:        if ($nobreak==2) { return ''; }
1.34      www       865:        my $text=$top.' '.$bot;
1.78      www       866:        $text=~s/\s*\-\s*//gs;
1.105     www       867: 
                    868:        my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
                    869:        if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
1.99      www       870:        my $pic=
1.177     albertel  871: 	   '<img alt="'.$text.'" src="http://'.$ENV{'HTTP_HOST'}.
1.105     www       872: 	   ':'.$lonhttpdPort.'/res/adm/pages/'.$img.'" align="'.
1.103     www       873: 	   ($nobreak==3?'right':'left').'" />';
1.177     albertel  874:        if ($env{'browser.interface'} eq 'faketextual') {
1.103     www       875: # Accessibility
                    876: 	   if ($nobreak==3) {
1.209     www       877: 	       $inlineremote[$idx]="\n".
1.177     albertel  878: 		   '<td class="LC_menubuttons_text" align="right">'.$text.
                    879: 		   '</td><td class="LC_menubuttons_img" align="left">'.
1.103     www       880: 		   '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
                    881: 	   } elsif ($nobreak) {
1.209     www       882: 	       $inlineremote[$idx]="\n<tr>".
1.177     albertel  883: 		   '<td class="LC_menubuttons_img" align="left">'.
                    884: 		   '<a href="javascript:'.$act.';">'.$pic.'</a></td>
1.215     www       885:                     <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       886: 	   } else {
1.209     www       887: 	       $inlineremote[$idx]="\n<tr>".
1.177     albertel  888: 		   '<td class="LC_menubuttons_img" align="left">'.
1.103     www       889: 		   '<a href="javascript:'.$act.';">'.$pic.
1.177     albertel  890: 		   '</a></td><td class="LC_menubuttons_text" colspan="3">'.
1.215     www       891: 		   '<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>';
1.103     www       892: 	   }
1.94      www       893:        } else {
1.103     www       894: # Inline Menu
1.218   ! www       895:            if ($env{'environment.icons'} eq 'iconsonly') {
        !           896:               $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
        !           897:            } else {
        !           898: 	      $inlineremote[$idx]=
1.215     www       899: 		   '<a class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
                    900: 		   '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
1.218   ! www       901:            }
1.94      www       902:        }
1.34      www       903:    }
1.56      www       904:     return '';
1.2       www       905: }
                    906: 
                    907: sub secondlevel {
                    908:     my $output='';
                    909:     my 
1.209     www       910:     ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat)=@_;
1.2       www       911:     if ($prt eq 'any') {
1.209     www       912: 	   $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.2       www       913:     } elsif ($prt=~/^r(\w+)/) {
                    914:         if ($rol eq $1) {
1.209     www       915:            $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.2       www       916:         }
                    917:     }
                    918:     return $output;
                    919: }
                    920: 
1.18      www       921: sub openmenu {
1.30      www       922:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.152     albertel  923:     if (($env{'browser.interface'} eq 'textual') ||
                    924:         ($env{'environment.remote'} eq 'off')) { return ''; }
1.47      matthew   925:     my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
                    926:     return "window.open(".$nothing.",'".$menuname."');";
1.18      www       927: }
                    928: 
1.56      www       929: sub inlinemenu {
1.210     albertel  930:     undef(@inlineremote);
                    931:     undef(%category_members);
1.56      www       932:     &rawconfig(1);
1.214     albertel  933:     my $output='<table id="LC_mainmenu"><tr>';
1.209     www       934:     for (my $col=1; $col<=2; $col++) {
1.214     albertel  935:         $output.='<td class="LC_mainmenu_column">';
1.209     www       936:         for (my $row=1; $row<=8; $row++) {
                    937:             foreach my $cat (keys(%category_members)) {
                    938:                if ($category_positions{$cat} ne "$col,$row") { next; }
1.214     albertel  939:                $output.='<table id="LC_menubuttons_mainmenu"><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
1.209     www       940:                my %active=();
                    941:                foreach my $menu_item (split(/\:/,$category_members{$cat})) {
                    942:                   if ($inlineremote[$menu_item]) {
                    943:                      $active{$menu_item}=1;
                    944:                   }
                    945:                }  
                    946:                foreach my $item (sort(keys(%active))) {
                    947:                   $output.=$inlineremote[$item];
                    948:                }
                    949:                $output.='</table>';
                    950:             }
                    951:          }
                    952:          $output.="</td>";
                    953:     }
                    954:     $output.="</tr></table>";
                    955:     return $output;
1.56      www       956: }
                    957: 
1.2       www       958: sub rawconfig {
1.34      www       959:     my $textualoverride=shift;
                    960:     my $output='';
1.152     albertel  961:     unless (($env{'browser.interface'} eq 'textual') ||
                    962:             ($env{'environment.remote'} eq 'off')) {
1.35      www       963:        $output.=
                    964:  "window.status='Opening Remote Control';var swmenu=".&openmenu().
                    965: "\nwindow.status='Configuring Remote Control ';";
1.34      www       966:     } else {
                    967:        unless ($textualoverride) { return ''; }
                    968:     }
1.152     albertel  969:     my $uname=$env{'user.name'};
                    970:     my $udom=$env{'user.domain'};
                    971:     my $adv=$env{'user.adv'};
                    972:     my $author=$env{'user.author'};
1.5       www       973:     my $crs='';
1.152     albertel  974:     if ($env{'request.course.id'}) {
                    975:        $crs='/'.$env{'request.course.id'};
                    976:        if ($env{'request.course.sec'}) {
                    977: 	   $crs.='_'.$env{'request.course.sec'};
1.7       www       978:        }
1.8       www       979:        $crs=~s/\_/\//g;
1.5       www       980:     }
1.152     albertel  981:     my $pub=($env{'request.state'} eq 'published');
                    982:     my $con=($env{'request.state'} eq 'construct');
                    983:     my $rol=$env{'request.role'};
                    984:     my $requested_domain = $env{'request.role.domain'};
1.184     raeburn   985:     foreach my $line (@desklines) {
1.209     www       986:         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
1.3       www       987:         $prt=~s/\$uname/$uname/g;
                    988:         $prt=~s/\$udom/$udom/g;
1.5       www       989:         $prt=~s/\$crs/$crs/g; 
1.25      matthew   990:         $prt=~s/\$requested_domain/$requested_domain/g;
1.211     www       991:         if ($category_names{$cat}!~/\w/) { $cat='oth'; }
1.186     albertel  992:         my $type = &Apache::loncommon::course_type();
1.184     raeburn   993:         if ($type eq 'Group') {
                    994:             $desc = &convert_menu_function($desc,$type);
                    995:         }
1.3       www       996:         if ($pro eq 'clear') {
1.4       www       997: 	    $output.=&clear($row,$col);
1.3       www       998:         } elsif ($pro eq 'any') {
1.2       www       999:                $output.=&secondlevel(
1.209     www      1000: 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2       www      1001: 	} elsif ($pro eq 'smp') {
                   1002:             unless ($adv) {
                   1003:                $output.=&secondlevel(
1.209     www      1004:           $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2       www      1005:             }
                   1006:         } elsif ($pro eq 'adv') {
                   1007:             if ($adv) {
                   1008:                $output.=&secondlevel(
1.209     www      1009: 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
1.2       www      1010:             }
1.81      matthew  1011:         } elsif (($pro=~/^p(\w+)/) && ($prt)) {
1.2       www      1012: 	    if (&Apache::lonnet::allowed($1,$prt)) {
1.209     www      1013:                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.4       www      1014:             }
1.26      www      1015:         } elsif ($pro eq 'course') {
1.152     albertel 1016:             if ($env{'request.course.fn'}) {
1.209     www      1017:                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.81      matthew  1018: 	    }
1.124     matthew  1019:         } elsif ($pro =~ /^courseenv_(.*)$/) {
                   1020:             my $key = $1;
1.152     albertel 1021:             if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {
1.209     www      1022:                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.124     matthew  1023:             }
1.81      matthew  1024:         } elsif ($pro =~ /^course_(.*)$/) {
                   1025:             # Check for permissions inside of a course
1.152     albertel 1026:             if (($env{'request.course.id'}) &&
                   1027:                 (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
                   1028:             ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
1.81      matthew  1029:                  )) {
1.209     www      1030:                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
1.26      www      1031: 	    }
1.4       www      1032:         } elsif ($pro eq 'author') {
                   1033:             if ($author) {
1.152     albertel 1034:                 if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
                   1035:                     (($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
1.19      matthew  1036:                     # Check that we are on the correct machine
1.29      matthew  1037:                     my $cadom=$requested_domain;
1.152     albertel 1038:                     my $caname=$env{'user.name'};
1.29      matthew  1039:                     if ($prt eq 'rca') {
                   1040: 		       ($cadom,$caname)=
1.206     albertel 1041:                                ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
1.29      matthew  1042:                     }                       
                   1043:                     $act =~ s/\$caname/$caname/g;
1.19      matthew  1044:                     my $home = &Apache::lonnet::homeserver($caname,$cadom);
1.109     albertel 1045: 		    my $allowed=0;
                   1046: 		    my @ids=&Apache::lonnet::current_machine_ids();
                   1047: 		    foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
                   1048: 		    if ($allowed) {
1.209     www      1049:                         $output.=&switch($caname,$cadom,
                   1050:                                         $row,$col,$img,$top,$bot,$act,$desc,$cat);
1.19      matthew  1051:                     }
1.6       www      1052:                 }
1.2       www      1053:             }
                   1054:         }
1.13      harris41 1055:     }
1.152     albertel 1056:     unless (($env{'browser.interface'} eq 'textual') ||
                   1057:             ($env{'environment.remote'} eq 'off')) {
1.35      www      1058:        $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
1.123     www      1059:        if (&Apache::lonmsg::newmail()) { 
                   1060: 	   $output.='swmenu.setstatus("you have","messages");';
                   1061:        }
1.34      www      1062:     }
1.123     www      1063: 
1.2       www      1064:     return $output;
                   1065: }
                   1066: 
                   1067: # ======================================================================= Close
1.1       www      1068: 
                   1069: sub close {
1.152     albertel 1070:     if (($env{'browser.interface'} eq 'textual') ||
                   1071:         ($env{'environment.remote'} eq 'off')) { return ''; }
1.30      www      1072:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.1       www      1073:     return(<<ENDCLOSE);
1.129     albertel 1074: <script type="text/javascript">
1.35      www      1075: window.status='Accessing Remote Control';
1.30      www      1076: menu=window.open("/adm/rat/empty.html","$menuname",
1.1       www      1077:                  "height=350,width=150,scrollbars=no,menubar=no");
1.35      www      1078: window.status='Disabling Remote Control';
                   1079: menu.active=0;
1.31      www      1080: menu.autologout=0;
1.35      www      1081: window.status='Closing Remote Control';
1.1       www      1082: menu.close();
1.35      www      1083: window.status='Done.';
1.1       www      1084: </script>
                   1085: ENDCLOSE
                   1086: }
                   1087: 
                   1088: # ====================================================================== Footer
                   1089: 
                   1090: sub footer {
                   1091: 
1.33      www      1092: }
                   1093: 
1.122     albertel 1094: sub nav_control_js {
1.152     albertel 1095:     my $nav=($env{'environment.remotenavmap'} eq 'on');
1.122     albertel 1096:     return (<<NAVCONTROL);
                   1097:     var w_loncapanav_flag="$nav";
                   1098: 
                   1099: 
                   1100: function gonav(url) {
                   1101:    if (w_loncapanav_flag != 1) {
                   1102:       gopost(url,'');
                   1103:    }  else {
                   1104:       navwindow=window.open(url,
                   1105:                   "loncapanav","height=600,width=400,scrollbars=1"); 
                   1106:    }
                   1107: }
                   1108: NAVCONTROL
                   1109: }
                   1110: 
1.42      www      1111: sub utilityfunctions {
1.132     raeburn  1112:     my $caller = shift;
1.152     albertel 1113:     unless (($env{'browser.interface'} eq 'textual')  ||
                   1114:         ($env{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; }
                   1115:     my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1.183     www      1116:     $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
1.125     albertel 1117:     
1.152     albertel 1118:     my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1.122     albertel 1119:     my $nav_control=&nav_control_js();
1.175     albertel 1120: 
                   1121:     my $start_page_annotate = 
                   1122:         &Apache::loncommon::start_page('Annotator',undef,
                   1123: 				       {'only_body' => 1,
                   1124: 					'js_ready'  => 1,
                   1125: 					'bgcolor'   => '#BBBBBB',
                   1126: 					'add_entries' => {
                   1127: 					    'onload' => 'javascript:document.goannotate.submit();'}});
                   1128: 
1.205     albertel 1129:     my $end_page_annotate = 
                   1130:         &Apache::loncommon::end_page({'js_ready' => 1});
                   1131: 
1.175     albertel 1132:     my $start_page_bookmark = 
                   1133:         &Apache::loncommon::start_page('Bookmarks',undef,
                   1134: 				       {'only_body' => 1,
                   1135: 					'js_ready'  => 1,
                   1136: 					'bgcolor'   => '#BBBBBB',});
                   1137: 
1.205     albertel 1138:     my $end_page_bookmark = 
1.175     albertel 1139:         &Apache::loncommon::end_page({'js_ready' => 1});
                   1140: 
1.42      www      1141: return (<<ENDUTILITY)
                   1142: 
                   1143:     var currentURL="$currenturl";
                   1144:     var reloadURL="$currenturl";
                   1145:     var currentSymb="$currentsymb";
                   1146: 
1.114     albertel 1147: $nav_control
                   1148: 
1.42      www      1149: function go(url) {
                   1150:    if (url!='' && url!= null) {
                   1151:        currentURL = null;
                   1152:        currentSymb= null;
                   1153:        window.location.href=url;
                   1154:    }
                   1155: }
                   1156: 
                   1157: function gopost(url,postdata) {
                   1158:    if (url!='') {
                   1159:       this.document.server.action=url;
                   1160:       this.document.server.postdata.value=postdata;
                   1161:       this.document.server.command.value='';
                   1162:       this.document.server.url.value='';
                   1163:       this.document.server.symb.value='';
                   1164:       this.document.server.submit();
                   1165:    }
                   1166: }
                   1167: 
                   1168: function gocmd(url,cmd) {
                   1169:    if (url!='') {
                   1170:       this.document.server.action=url;
                   1171:       this.document.server.postdata.value='';
                   1172:       this.document.server.command.value=cmd;
                   1173:       this.document.server.url.value=currentURL;
                   1174:       this.document.server.symb.value=currentSymb;
                   1175:       this.document.server.submit();
                   1176:    }
1.57      www      1177: }
                   1178: 
1.121     raeburn  1179: function gocstr(url,filename) {
                   1180:     if (url == '/adm/cfile?action=delete') {
                   1181:         this.document.cstrdelete.filename.value = filename
                   1182:         this.document.cstrdelete.submit();
                   1183:         return;
                   1184:     }
1.137     raeburn  1185:     if (url == '/adm/printout') {
                   1186:         this.document.cstrprint.postdata.value = filename
                   1187:         this.document.cstrprint.curseed.value = 0;
                   1188:         this.document.cstrprint.problemtype.value = 0;
1.138     raeburn  1189:         if (this.document.lonhomework) {
                   1190:             if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
                   1191:                 this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
                   1192:             }
                   1193:             if (this.document.lonhomework.problemtype) {
1.164     albertel 1194: 		if (this.document.lonhomework.problemtype.value) {
                   1195: 		    this.document.cstrprint.problemtype.value = 
                   1196: 			this.document.lonhomework.problemtype.value;
                   1197: 		} else if (this.document.lonhomework.problemtype.options) {
                   1198: 		    for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
                   1199: 			if (this.document.lonhomework.problemtype.options[i].selected) {
                   1200: 			    if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') { 
                   1201: 				this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
                   1202: 				}
                   1203: 			}
                   1204: 		    }
                   1205: 		}
                   1206: 	    }
                   1207: 	}
1.137     raeburn  1208:         this.document.cstrprint.submit();
                   1209:         return;
                   1210:     }
1.121     raeburn  1211:     if (url !='') {
                   1212:         this.document.constspace.filename.value = filename;
                   1213:         this.document.constspace.action = url;
                   1214:         this.document.constspace.submit();
                   1215:     }
                   1216: }
                   1217: 
1.131     raeburn  1218: function golist(url) {
                   1219:    if (url!='' && url!= null) {
                   1220:        currentURL = null;
                   1221:        currentSymb= null;
                   1222:        top.location.href=url;
                   1223:    }
                   1224: }
                   1225: 
                   1226: 
1.121     raeburn  1227: 
1.57      www      1228: function catalog_info() {
1.102     albertel 1229:    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      1230: }
                   1231: 
                   1232: function chat_win() {
1.102     albertel 1233:    lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
1.42      www      1234: }
1.169     raeburn  1235: 
                   1236: function group_chat(group) {
                   1237:    var url = '/adm/groupchat?group='+group;
                   1238:    var winName = 'LONchat_'+group;
                   1239:    grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
                   1240: }
1.175     albertel 1241: 
                   1242: function edit_bookmarks() {
                   1243:    go('');
                   1244:    w_BookmarkPal_flag=1;
                   1245:    bookmarkpal=window.open("/adm/bookmarks",
                   1246:                "BookmarkPal", "width=400,height=505,scrollbars=0");
                   1247: }
                   1248: 
                   1249: function annotate() {
                   1250:    w_Annotator_flag=1;
                   1251:    annotator=window.open('','Annotator','width=365,height=265,scrollbars=0');
                   1252:    annotator.document.write(
                   1253:    '$start_page_annotate'
                   1254:   +"<form name='goannotate' target='Annotator' method='post' "
                   1255:   +"action='/adm/annotations'>"
1.217     albertel 1256:   +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
1.181     albertel 1257:   +"<\\/form>"
1.205     albertel 1258:   +'$end_page_annotate');
1.175     albertel 1259:    annotator.document.close();
                   1260: }
                   1261: 
                   1262: function set_bookmark() {
                   1263:    go('');
                   1264:    clienttitle=document.title;
                   1265:    clienthref=location.pathname;
                   1266:    w_bmquery_flag=1;
                   1267:    bmquery=window.open('','bmquery','width=365,height=165,scrollbars=0');
                   1268:    bmquery.document.write(
                   1269:    '$start_page_bookmark'
                   1270:    +"<center><form method='post'"
                   1271:    +" name='newlink' action='/adm/bookmarks' target='bmquery' "
                   1272:    +">\\n <table width=340 height=150 "
1.181     albertel 1273:    +"bgcolor='ffffff' align=center><tr><td>Link Name:<br /><input "
                   1274:    +"type='text' name='title' size=45 value='"+clienttitle+"' />"
                   1275:    +"<br />Address:<br /><input type='text' name='address' size='45' "
                   1276:    +"value='"+clienthref+"' /><br /><center><input type='submit' "
                   1277:    +"value='Save' /> <input type='button' value='Close (no save)' "
                   1278:    +"onclick='javascript:window.close();' /><\\/center><\\/td>"
                   1279:    +"<\\/tr><\\/table><\\/form><\\/center>"
1.205     albertel 1280:    +'$end_page_bookmark' );
1.175     albertel 1281:    bmquery.document.close();
                   1282: }
                   1283: 
1.42      www      1284: ENDUTILITY
                   1285: }
                   1286: 
                   1287: sub serverform {
                   1288:     return(<<ENDSERVERFORM);
1.181     albertel 1289: <form name="server" action="/adm/logout" method="post" target="_top">
1.42      www      1290: <input type="hidden" name="postdata" value="none" />
                   1291: <input type="hidden" name="command" value="none" />
                   1292: <input type="hidden" name="url" value="none" />
                   1293: <input type="hidden" name="symb" value="none" />
                   1294: </form>
                   1295: ENDSERVERFORM
                   1296: }
1.113     albertel 1297: 
1.121     raeburn  1298: sub constspaceform {
                   1299:     return(<<ENDCONSTSPACEFORM);
1.181     albertel 1300: <form name="constspace" action="/adm/logout" method="post" target="_top">
1.121     raeburn  1301: <input type="hidden" name="filename" value="" />
                   1302: </form>
1.181     albertel 1303: <form name="cstrdelete" action="/adm/cfile" method="post" target="_top">
1.121     raeburn  1304: <input type="hidden" name="action" value="delete" /> 
                   1305: <input type="hidden" name="filename" value="" />
                   1306: </form>
1.181     albertel 1307: <form name="cstrprint" action="/adm/printout" target="_parent" method="post">
1.137     raeburn  1308: <input type="hidden" name="postdata" value="" />
                   1309: <input type="hidden" name="curseed" value="" />
                   1310: <input type="hidden" name="problemtype" value="" />
                   1311: </form>
                   1312: 
1.121     raeburn  1313: ENDCONSTSPACEFORM
                   1314: }
                   1315: 
                   1316: 
1.113     albertel 1317: sub get_nav_status {
                   1318:     my $navstatus="swmenu.w_loncapanav_flag=";
1.152     albertel 1319:     if ($env{'environment.remotenavmap'} eq 'on') {
1.113     albertel 1320: 	$navstatus.="1";
                   1321:     } else {
                   1322: 	$navstatus.="-1";
                   1323:     }
                   1324:     return $navstatus;
                   1325: }
                   1326: 
1.186     albertel 1327: #FIXME this needs to move into mydesktab and the other locations 
                   1328: # the text is generated
1.184     raeburn  1329: sub convert_menu_function {
                   1330:     my ($rolename,$type) = @_;
                   1331:     if ($type eq 'Group') {
                   1332:         $rolename =~ s/student/member/g;
                   1333:         $rolename =~ s/group/team/g;
                   1334:         $rolename =~ s/course/group/g;
                   1335:         $rolename =~ s/Course/Group/g;
                   1336:     }
                   1337:     return $rolename;
                   1338: }
                   1339: 
                   1340: 
1.2       www      1341: # ================================================================ Main Program
                   1342: 
1.16      harris41 1343: BEGIN {
1.166     albertel 1344:     if (! defined($readdesk)) {
                   1345: 	{
                   1346: 	    my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
                   1347: 	    if ( CORE::open( my $config,"<$tabfile") ) {
                   1348: 		while (my $configline=<$config>) {
                   1349: 		    $configline=(split(/\#/,$configline))[0];
                   1350: 		    $configline=~s/^\s+//;
                   1351: 		    chomp($configline);
1.209     www      1352:                     if ($configline=~/^cat\:/) {
                   1353:                        my @entries=split(/\:/,$configline);
                   1354:                        $category_positions{$entries[2]}=$entries[1];
                   1355:                        $category_names{$entries[2]}=$entries[3];
                   1356: 		    } elsif ($configline) {
1.166     albertel 1357: 			push(@desklines,$configline);
                   1358: 		    }
                   1359: 		}
                   1360: 		CORE::close($config);
                   1361: 	    }
                   1362: 	}
                   1363: 	$readdesk='done';
1.2       www      1364:     }
                   1365: }
1.30      www      1366: 
1.1       www      1367: 1;
                   1368: __END__
                   1369: 
                   1370: 
                   1371: 
                   1372: 
                   1373: 
                   1374: 
                   1375: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>