File:  [LON-CAPA] / loncom / interface / lonaboutme.pm
Revision 1.50: download - view: text, annotated - select for diffs
Mon Aug 7 19:51:54 2006 UTC (17 years, 9 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- use the title in the listing if one exists

    1: # The LearningOnline Network
    2: # "About Me" Personal Information
    3: #
    4: # $Id: lonaboutme.pm,v 1.50 2006/08/07 19:51:54 albertel Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: 
   29: package Apache::lonaboutme;
   30: 
   31: use strict;
   32: use Apache::Constants qw(:common);
   33: use Apache::loncommon;
   34: use Apache::lonnet;
   35: use Apache::lontexconvert;
   36: use Apache::lonfeedback;
   37: use Apache::lonrss();
   38: use Apache::lonlocal;
   39: use Apache::lonmsgdisplay();
   40: 
   41: sub handler {
   42:     my $r = shift;
   43:     &Apache::loncommon::content_type($r,'text/html');
   44:     $r->send_http_header;
   45:     return OK if $r->header_only;
   46:     my $target=$env{'form.grade_target'};
   47: # ------------------------------------------------------------ Print the screen
   48:     if ($target eq 'tex') {
   49: 	$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
   50:     }
   51:     my (undef,undef,$cdom,$cnum,undef,$action)=split(/\//,$r->uri);
   52: # Is this even a user?
   53:     if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
   54: 	&Apache::loncommon::simple_error_page($r,'No info',
   55: 					      'No user information available');
   56:         return OK;
   57:     }
   58: # --------------------------------------------------------- The syllabus fields
   59:     my %syllabusfields=&Apache::lonlocal::texthash(
   60:        'aaa_contactinfo'   => 'Contact Information',
   61:        'bbb_aboutme'       => 'About Me',
   62:        'ccc_webreferences' => 'Web References');
   63: 
   64: # ------------------------------------------------------------ Get Query String
   65:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
   66: 					    ['forceedit','forcestudent',
   67: 					     'register']);
   68: 
   69: # ----------------------------------------------- Available Portfolio file display 
   70:     if (($target ne 'tex') && ($action eq 'portfolio')) {
   71:         &display_portfolio_header($r);
   72:         &display_portfolio_files($r);
   73:         $r->print(&Apache::loncommon::end_page());
   74:         return OK;
   75:     }
   76: 
   77: # --------------------------------------------------------------- Force Student
   78:     my $forcestudent='';
   79:     if ($env{'form.forcestudent'}) { $forcestudent='student'; };
   80: 
   81:     my $forceregister = '';
   82:     if ($forcestudent eq '') {
   83:         $forceregister = $env{'form.register'};
   84:     }
   85:        
   86: # --------------------------------------- There is such a user, get environment
   87:     my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
   88:     if ($target ne 'tex') {
   89: 	my $start_page = 
   90: 	    &Apache::loncommon::start_page("Personal Information",undef,
   91: 					   {'function'       => $forcestudent,
   92:  					    'domain'         => $cdom,
   93: 					    'force_register' =>
   94: 						            $forceregister,});
   95: 	$r->print($start_page);
   96: 	$r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');
   97:     } else {
   98: 	$r->print('\noindent{\large\textbf{'.&Apache::loncommon::plainname($cnum,$cdom).'}}\\\\\\\\');
   99:     }
  100:     if ($courseenv{'nickname'}) {
  101:        $r->print(
  102:          '<h2>&quot;'.$courseenv{'nickname'}.
  103:          '&quot;</h2>');
  104:     }
  105:     if ($target ne 'tex') {
  106: 	$r->print('<h3>'.$Apache::lonnet::domaindescription{$cdom}.'</h3>'.
  107: 		  '<p>'.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom));
  108:     } else {
  109: 	$r->print('\textbf{'.$Apache::lonnet::domaindescription{$cdom}.'}\\\\');
  110:     }
  111:     my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);
  112:     my $allowed=0;
  113: 
  114: # does this user have privileges to post, etc?
  115: 
  116:        my $privleged=$allowed=(($env{'user.name'} eq $cnum) && 
  117: 			       ($env{'user.domain'} eq $cdom));
  118:        if ($forcestudent or $target eq 'tex') { $allowed=0; }
  119:  
  120:        if ($allowed) {
  121:            my $query_string = &build_query_string({'forcestudent' => '1',});
  122: 	   $r->print('<p><b>'.&mt('Privacy Note').':</b> '.
  123: 		     &mt('The information you submit can be viewed by anybody who is logged into LON-CAPA. Do not provide information that you are not ready to share publicly.').
  124: 		     '</p>'.
  125: 		     &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'</p><p><a href="'.$r->uri.$query_string.'">Show Public View</a>'.
  126: 		     &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
  127:        } elsif ($privleged && $target ne 'tex') {
  128:            my $query_string = &build_query_string({'forceedit' => '1',});
  129: 	   $r->print('<p><a href="'.$r->uri.$query_string.'"><font size="+1">'.
  130: 		     &mt('Edit').'</font></a></p>');
  131:        }
  132:       if (($env{'form.uploaddoc.filename'}) &&
  133:           ($env{'form.storeupl'}) && ($allowed)) {
  134:  	  if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
  135: 	      if ($syllabus{'uploaded.photourl'}) {
  136: 		  &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
  137: 	      }
  138: 	      $syllabus{'uploaded.photourl'}=
  139:                  &Apache::lonnet::userfileupload('uploaddoc',undef,'aboutme');
  140:  	  }
  141:           $syllabus{'uploaded.lastmodified'}=time;
  142:           &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
  143:        }
  144:     if ($allowed && $env{'form.delupl'}) {
  145: 	if ($syllabus{'uploaded.photourl'}) {
  146: 	    &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
  147: 	    delete($syllabus{'uploaded.photourl'});
  148: 	    &Apache::lonnet::del('aboutme',['uploaded.photourl'],$cdom,$cnum);
  149: 	}
  150:     }
  151:        if (($allowed) && ($env{'form.storesyl'})) {
  152: 	   foreach (keys %syllabusfields) {
  153:                my $field=$env{'form.'.$_};
  154:                $field=~s/\s+$//s;
  155:                $field=&Apache::lonfeedback::clear_out_html($field,
  156:                                                            $env{'user.adv'});
  157: 	       $syllabus{$_}=$field;
  158:            }
  159:            $syllabus{'uploaded.lastmodified'}=time;
  160:            &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
  161:        }
  162: 
  163: # ---------------------------------------------------------------- Get syllabus
  164:     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
  165:        my $lastmod=$syllabus{'uploaded.lastmodified'};
  166:        $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
  167:        $r->print(&mt('Last updated').': '.$lastmod);
  168:        if ($syllabus{'uploaded.photourl'}) {
  169: 	   &Apache::lonnet::allowuploaded('/adm/aboutme',
  170: 					  $syllabus{'uploaded.photourl'});
  171: 	   my $image=
  172:                qq{<img src="$syllabus{'uploaded.photourl'}" align="right" />};
  173: 	   if ($target eq 'tex') {
  174: 	       $image=&Apache::lonxml::xmlparse($r,'tex',$image);
  175: 	   }
  176: 	   $r->print($image);
  177:        }
  178:        if ($allowed) {
  179:            $r->print(
  180: 	 '<form method="post">
  181:                <input type="submit" name="delupl" value="Delete Photo" />
  182:           </form>'.
  183: 	 '<form method="post" enctype="multipart/form-data">'.
  184:          '<h3>'.&mt('Upload a Photo').'</h3>'.
  185:          '<input type="file" name="uploaddoc" size="50">'.
  186:          '<input type="submit" name="storeupl" value="Upload">'.
  187: 	 '</form><form method="post">');
  188: 
  189:        }
  190:        foreach (sort keys %syllabusfields) {
  191:           if (($syllabus{$_}) || ($allowed)) {
  192:               my $message=$syllabus{$_};
  193: 	      &Apache::lonfeedback::newline_to_br(\$message);
  194:               $message
  195:              =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
  196: 	      if ($allowed) {
  197: 		  $message=&Apache::lonspeller::markeduptext($message);
  198: 	      }
  199: 	      $message=&Apache::lontexconvert::msgtexconverted($message);
  200: 	      if ($target ne 'tex') {
  201: 		  $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
  202:                             $message.'</blockquote>');
  203: 	      } else {
  204: 		     $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.
  205: 			       &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
  206: 	      }
  207:               if ($allowed) {
  208:                  $r->print('<br /><textarea cols="80" rows="6" name="'.$_.'">'.
  209: 			   $syllabus{$_}.
  210:            '</textarea><input type="submit" name="storesyl" value="'.
  211: 			   &mt('Store').'" />');
  212: 	      }
  213: 	  }
  214:        }
  215:        if ($allowed) {
  216: 	   $r->print('</form>');
  217:        }
  218:        if ($target ne 'tex') {$r->print('<br />');} else {$r->print('\\\\');}
  219:     } else {
  220:        $r->print('<p>'.&mt('No personal information provided').'.</p>');
  221:     }
  222: 
  223:     if ($target ne 'tex') {
  224:         &print_portfiles_link($r);
  225:     }
  226: 
  227:     if ($env{'request.course.id'}) {
  228: 	if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) {
  229: 	    if ($target ne 'tex') {
  230: 		$r->print('<a name="coursecomment" />');
  231: 		$r->print('<hr /><h3>'.
  232:                           &mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'</h3>'.
  233:                           &mt('Shared by course faculty and staff').
  234:                           &Apache::loncommon::help_open_topic("Course_Face_To_Face_Records,Course_Critical_Message").
  235: '<br />');
  236:                 &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
  237:                 $r->print('<hr />');
  238:                 if (&Apache::lonnet::allowed('vsa',
  239:                                              $env{'request.course.id'}) ||
  240:                     &Apache::lonnet::allowed('vsa',
  241:                                              $env{'request.course.id'}.'/'.
  242:                                              $env{'request.course.sec'})) {
  243:                     $r->print(&Apache::loncommon::track_student_link
  244:                               ('View recent activity by this student',
  245:                                $cnum,$cdom).('&nbsp;'x2));
  246:                 }
  247:                 $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));
  248: 	    } else {
  249: 		$r->print('\\\\\textbf{'.&mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'}\\\\'.&mt('Shared by course faculty and staff').'\\\\\\\\');
  250: 		&Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
  251: 	    }
  252:         }
  253:     }
  254:     if ($target ne 'tex') {
  255: 	$r->print(&Apache::loncommon::end_page());
  256:     } else {
  257: 	$r->print('\end{document}');
  258:     }
  259:     return OK;
  260: }
  261: 
  262: sub aboutme_info {
  263:     my ($r) = @_;
  264:     my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
  265:     my $name = &Apache::loncommon::plainname($cnum,$cdom);
  266:     return ($cdom,$cnum,$name);
  267: }
  268: 
  269: sub print_portfiles_link {
  270:     my ($r) = @_;
  271:     my ($cdom,$cnum,$name) = &aboutme_info($r);
  272:     my $filecounts = &portfolio_files($r,'showlink');
  273:     my $query_string = &build_query_string();
  274:     my $output;
  275:     if ($filecounts->{'both'} > 0) {
  276:         $output = &mt('<h3>Viewable portfolio files</h3>');
  277:         $output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'.
  278:                    $query_string.'">'.&mt('Display file listing').
  279:                    '</a><br /><br />';
  280:         $output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'<ul>';
  281:         if ($filecounts->{'withoutpass'}) {
  282:             $output .= '<li>'.&mt('[quant,_1,file] are publicly accessible.',$filecounts->{'withoutpass'}).'</li>';   
  283:         }
  284:         if ($filecounts->{'withpass'}) {
  285:             $output .= '<li>'.&mt('[quant,_1,file] require a passphrase for access.',$filecounts->{'withpass'}).'</li>';
  286:         }
  287:         $output .= '</ul>';
  288:     }
  289:     $r->print($output);
  290:     return;
  291: }
  292: 
  293: sub build_query_string {
  294:     my ($new_items) = @_;
  295:     my $query_string;
  296:     my @formelements = ('register'); 
  297:     my $new = 0;
  298:     if (ref($new_items) eq 'HASH') {
  299:         $new = 1;
  300:         if (!defined($new_items->{'forceedit'}) && 
  301:             !defined($new_items->{'forcestudent'})) {
  302:             push(@formelements,('forceedit','forcestudent'));
  303:         }
  304:     } else {
  305:         push(@formelements,('forceedit','forcestudent'));
  306:     }
  307:     foreach my $element (@formelements) {
  308:         if (exists($env{'form.'.$element})) {
  309:             if ((!$new) || (!defined($new_items->{$element}))) {
  310:                 $query_string .= '&amp;'.$element.'='.$env{'form.'.$element};
  311:             }
  312:         }
  313:     }
  314:     if ($new) {
  315:         foreach my $key (keys(%{$new_items})) {
  316:             $query_string .= '&amp;'.$key.'='.$new_items->{$key};
  317:         }
  318:     }
  319:     $query_string =~ s/^\&amp;/\?/;
  320:     return $query_string;
  321: }
  322: 
  323: sub display_portfolio_header {
  324:     my ($r) = @_;
  325:     my ($cdom,$cnum,$name) = &aboutme_info($r);
  326:     my $query_string = &build_query_string();
  327:     &Apache::lonhtmlcommon::clear_breadcrumbs();
  328:     my $forcestudent='';
  329:     if ($env{'form.forcestudent'}) { $forcestudent='student'; };
  330:     my $output =
  331:         &Apache::loncommon::start_page('Viewable portfolio files',undef,
  332:                                             {'function' => $forcestudent, 
  333:                                              'domain'   => $cdom,});
  334:     &Apache::lonhtmlcommon::add_breadcrumb
  335:         ({href=>"/adm/$cdom/$cnum/aboutme".$query_string,
  336:           text=>"Personal information - $name",
  337:           title=>"Go to personal information page for $name"},
  338:          {href=>"/adm/$cdom/$cnum/aboutme/portfolio",
  339:           text=>"Viewable files - $name",
  340:           title=>"Viewable portfolio files for $name"}
  341: );
  342:     $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Viewable portfolio files.'));
  343:     $output .= '<h3>'.&mt('Portfolio files for [_1]',$name).'</h3>';
  344:     $r->print($output);
  345:     return;
  346: }
  347: 
  348: sub display_portfolio_files {
  349:     my ($r) = @_;
  350:     my ($cdom,$cnum,$name) = &aboutme_info($r);
  351:     my %lt = ( withoutpass => 'passphrase not required',
  352: 	       withpass    => 'passphrase protected',
  353: 	       both        => 'all access types ',);
  354:     %lt = &Apache::lonlocal::texthash(%lt);
  355: 
  356:     my $portaccess = 'withoutpass';
  357:     if (exists($env{'form.portaccess'})) {
  358:         $portaccess = $env{'form.portaccess'};
  359:     }
  360: 
  361:     my $output = '<form action="'.&HTML::Entities::encode($r->uri,'<>&"')
  362: 	.'" name="displaystatus" method="post">'.
  363: 	&mt('File access type: ').'<select name="portaccess">';
  364:     foreach my $type ('withoutpass','withpass','both') {
  365:         $output .= '<option value="'.$type.'" ';
  366:         if ($portaccess eq $type) {
  367:             $output .= 'selected="selected"';
  368:         }
  369:         $output .= '>'.&mt($type).'</option>';
  370:     }
  371:     $output .= '</select>'."\n".
  372:                '<input type="submit" name="portaccessbutton" value="'.
  373:                &mt('Update display').'" />';
  374:     $output .= '</form><br /><br />';
  375:     $r->print($output);
  376:     my $filecounts = &portfolio_files($r,'listfiles',\%lt);
  377:     my $query_string = &build_query_string();
  378:     $r->print('<br /><br /><a href="/adm/'.$cdom.'/'.$cnum.
  379:                '/aboutme'.$query_string.'">'.
  380:                &mt('Information about [_1]',$name).'</a>');
  381:     return;
  382: }
  383: 
  384: sub portfolio_files {
  385:     my ($r,$mode,$lt) = @_;
  386:     my ($cdom,$cnum,$name) = &aboutme_info($r);
  387:     my $filecounts = {
  388:                        withpass    => 0,
  389:                        withoutpass => 0,
  390:                        both        => 0,
  391:                      };
  392:     my $current_permissions =
  393: 	&Apache::lonnet::get_portfile_permissions($cdom,$cnum);
  394:     my %access_controls = 
  395: 	&Apache::lonnet::get_access_controls($current_permissions);
  396:     my %allfileshash;
  397:     my $portaccess;
  398:     if ($mode eq 'showlink') {
  399:         $portaccess = 'both';
  400:     } else {
  401:         $portaccess = 'withoutpass';
  402:         if (exists($env{'form.portaccess'})) {
  403:             $portaccess = $env{'form.portaccess'};
  404:         }
  405:     }
  406: 
  407:     foreach my $filename (keys(%access_controls)) {
  408:         my $access_status = 
  409:             &Apache::lonnet::get_portfolio_access($cdom,$cnum,$filename,undef,
  410: 						  $access_controls{$filename});
  411:         if ($portaccess eq 'both') {
  412:             if (($access_status ne 'ok') &&
  413:                 ($access_status !~  /^[^:]+:guest_/)) {
  414:                 next;
  415:             }
  416:         } elsif ($portaccess eq 'withoutpass') {
  417:             if ($access_status ne 'ok') {
  418:                 next;
  419:             }
  420:         } elsif ($portaccess eq 'withpass') {
  421:             if ($access_status !~  /^[^:]+:guest_/) {
  422:                 next;
  423:             }
  424:         }
  425:         if ($mode eq 'listfiles') {
  426:             $filename =~ s/^\///;
  427:             my @pathitems = split('/',$filename);
  428:             my $lasthash = \%allfileshash;
  429:             while (@pathitems > 1) {
  430:                 my $newlevel = shift(@pathitems);
  431:                 if (!exists($lasthash->{$newlevel})) {
  432:                     $lasthash->{$newlevel} = {};
  433:                 }
  434:                 $lasthash = $lasthash->{$newlevel};
  435:             }
  436:             $lasthash->{$pathitems[0]} = $filename;
  437:         }
  438:         if ($access_status eq 'ok') {
  439:             $filecounts->{'withoutpass'} ++;
  440:         } elsif ($access_status =~  /^[^:]+:guest_/) {
  441:             $filecounts->{'withpass'} ++;
  442:         }
  443:     }
  444:     $filecounts->{'both'} =  $filecounts->{'withoutpass'} +
  445:                               $filecounts->{'withpass'};
  446:     if ($mode eq 'listfiles') {
  447:         my $output;
  448:         if (keys(%allfileshash) > 0) {
  449:             $output = &portfolio_table_start();
  450:             $output .= &parse_directory($r,0,\%allfileshash,'');
  451:             $output .= '</table>';
  452:         } else {
  453:             my $access_text;
  454:             if (ref($lt) eq 'HASH') {
  455:                 $access_text = $lt->{$portaccess};   
  456:             }
  457:             $output .= &mt('There are no available files of the specified access type: [_1]',$access_text);
  458:         }
  459:         $r->print($output);
  460:     }
  461:     return $filecounts;
  462: }
  463: 
  464: { 
  465:     my $count=0;
  466:     sub portfolio_table_start {
  467: 	$count=0;
  468: 	return '<table class="LC_aboutme_port">';
  469:     }
  470:     sub portfolio_row_start {
  471: 	$count++;
  472: 	my $class = ($count%2)?'LC_odd_row'
  473: 	                      :'LC_even_row';
  474: 	return '<tr class="'.$class.'">';
  475:     }
  476: }
  477: 
  478: sub parse_directory {
  479:     my ($r,$depth,$currhash,$path) = @_;
  480:     my ($cdom,$cnum,$name) = &aboutme_info($r);
  481:     $depth++;
  482:     my $output;
  483: 
  484:     my $portfolio_root =  &Apache::portfolio::get_portfolio_root($cdom,$cnum); 
  485:     my %dirlist = map {
  486: 	    ((split('&',$_,2))[0],1)
  487: 	} &Apache::lonnet::dirlist($path,$cdom,$cnum,$portfolio_root);
  488:     foreach my $item (sort(keys(%{$currhash}))) {
  489:         $output .= &portfolio_row_start();
  490:         $output .= '<td style="padding-left: '.($depth*25).'px">';
  491:         if (ref($currhash->{$item}) eq 'HASH') {
  492:             my $title=&HTML::Entities::encode($item,'<>&"');
  493:             $output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.'" class="LC_icon" />&nbsp;'.$title;
  494: 	    $output .= '</td><td></td></tr>';
  495:             $output .= &parse_directory($r,$depth,$currhash->{$item},
  496: 					$path.'/'.$item);
  497:         } else {
  498: 	   
  499: 
  500: 	    my $file_name; 
  501: 	    if ($currhash->{$item} =~ m|/([^/]+)$|) {
  502: 		$file_name = $1;
  503: 	    } else {
  504: 		$file_name = $currhash->{$item};
  505: 	    }
  506: 	    my $have_meta = exists($dirlist{$file_name.'.meta'});
  507: 	    my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.
  508: 		$currhash->{$item};
  509: 
  510:             my $showname;
  511: 	    if ($have_meta) {
  512: 		$showname = &Apache::lonnet::metadata($url,'title');
  513: 	    }
  514: 	    if ($showname eq '') {
  515: 		$showname = $file_name;
  516: 	    } else {
  517: 		$showname = $file_name.' ('.$showname.')';
  518: 	    }
  519: 
  520:             $showname=&HTML::Entities::encode($showname,'<>&"');
  521:             $output .= '<a href="'.$url.'">'.
  522: 		'<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />'.
  523: 		'&nbsp;'.$showname.'</a>';
  524: 	    $output.='</td><td>';
  525: 	    &Apache::lonnet::logthis("sh $showname");
  526: 	    if ($have_meta) {
  527: 		$output.= '<a href="'.$url.'.meta"><img alt="'.&mt('Catalog Information').'" src="'.
  528: 		&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').
  529: 		'" class="LC_icon" /></a>';
  530: 	    }
  531: 	    $output .= '</td></tr>';
  532:         }
  533:     }
  534:     return $output;
  535: }
  536: 
  537: 1;
  538: __END__

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