version 1.48, 2006/08/04 19:42:55
|
version 1.50, 2006/08/07 19:51:54
|
Line 447 sub portfolio_files {
|
Line 447 sub portfolio_files {
|
my $output; |
my $output; |
if (keys(%allfileshash) > 0) { |
if (keys(%allfileshash) > 0) { |
$output = &portfolio_table_start(); |
$output = &portfolio_table_start(); |
$output .= &parse_directory($r,0,\%allfileshash); |
$output .= &parse_directory($r,0,\%allfileshash,''); |
$output .= '</table>'; |
$output .= '</table>'; |
} else { |
} else { |
my $access_text; |
my $access_text; |
Line 476 sub portfolio_files {
|
Line 476 sub portfolio_files {
|
} |
} |
|
|
sub parse_directory { |
sub parse_directory { |
my ($r,$depth,$currhash) = @_; |
my ($r,$depth,$currhash,$path) = @_; |
my ($cdom,$cnum,$name) = &aboutme_info($r); |
my ($cdom,$cnum,$name) = &aboutme_info($r); |
$depth++; |
$depth++; |
my $output; |
my $output; |
|
|
|
my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum); |
|
my %dirlist = map { |
|
((split('&',$_,2))[0],1) |
|
} &Apache::lonnet::dirlist($path,$cdom,$cnum,$portfolio_root); |
foreach my $item (sort(keys(%{$currhash}))) { |
foreach my $item (sort(keys(%{$currhash}))) { |
$output .= &portfolio_row_start(); |
$output .= &portfolio_row_start(); |
$output .= '<td style="padding-left: '.($depth*25).'px">'; |
$output .= '<td style="padding-left: '.($depth*25).'px">'; |
Line 487 sub parse_directory {
|
Line 492 sub parse_directory {
|
my $title=&HTML::Entities::encode($item,'<>&"'); |
my $title=&HTML::Entities::encode($item,'<>&"'); |
$output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.'" class="LC_icon" /> '.$title; |
$output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.'" class="LC_icon" /> '.$title; |
$output .= '</td><td></td></tr>'; |
$output .= '</td><td></td></tr>'; |
$output .= &parse_directory($r,$depth,$currhash->{$item}); |
$output .= &parse_directory($r,$depth,$currhash->{$item}, |
|
$path.'/'.$item); |
} else { |
} else { |
my $showname; |
|
if ($currhash->{$item} =~ m|/([^/]+)$|) { |
|
$showname = $1; |
my $file_name; |
} else { |
if ($currhash->{$item} =~ m|/([^/]+)$|) { |
$showname = $currhash->{$item}; |
$file_name = $1; |
} |
} else { |
$showname=&HTML::Entities::encode($showname,'<>&"'); |
$file_name = $currhash->{$item}; |
|
} |
|
my $have_meta = exists($dirlist{$file_name.'.meta'}); |
my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'. |
my $url = '/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'. |
$currhash->{$item}; |
$currhash->{$item}; |
$output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" /> <a href="'.$url.'">'.$showname.'</a>'; |
|
$output.='</td><td><a href="'.$url.'.meta"><img align="right" alt="'.&mt('Catalog Information').'" src="'. |
|
&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif'). |
|
'" /></a>'; |
|
|
|
|
my $showname; |
|
if ($have_meta) { |
|
$showname = &Apache::lonnet::metadata($url,'title'); |
|
} |
|
if ($showname eq '') { |
|
$showname = $file_name; |
|
} else { |
|
$showname = $file_name.' ('.$showname.')'; |
|
} |
|
|
|
$showname=&HTML::Entities::encode($showname,'<>&"'); |
|
$output .= '<a href="'.$url.'">'. |
|
'<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />'. |
|
' '.$showname.'</a>'; |
|
$output.='</td><td>'; |
|
&Apache::lonnet::logthis("sh $showname"); |
|
if ($have_meta) { |
|
$output.= '<a href="'.$url.'.meta"><img alt="'.&mt('Catalog Information').'" src="'. |
|
&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif'). |
|
'" class="LC_icon" /></a>'; |
|
} |
$output .= '</td></tr>'; |
$output .= '</td></tr>'; |
} |
} |
} |
} |