version 1.44, 2006/08/02 19:29:35
|
version 1.45, 2006/08/02 20:18:10
|
Line 281 sub print_portfiles_link {
|
Line 281 sub print_portfiles_link {
|
$output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme'. |
$output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme'. |
$query_string.'">'.&mt('Display file listing'). |
$query_string.'">'.&mt('Display file listing'). |
'</a><br /><br />'; |
'</a><br /><br />'; |
$output .= &mt('A total of [_1] portfolio files owned by [_2] are available for viewing.',$filecounts->{'both'},$name).'<ul>'; |
$output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'<ul>'; |
if ($filecounts->{'withoutpass'}) { |
if ($filecounts->{'withoutpass'}) { |
$output .= '<li>'.&mt('[_1] files are either publicly accessible, or directly available to you because of your current role, domain and/or username.',$filecounts->{'withoutpass'}).'</li>'; |
$output .= '<li>'.&mt('[quant,_1,file] are publicly accessible.',$filecounts->{'withoutpass'}).'</li>'; |
} |
} |
if ($filecounts->{'withpass'}) { |
if ($filecounts->{'withpass'}) { |
$output .= '<li>'.&mt('[_1] files will be available after you have entered a passphrase set for each specific file.',$filecounts->{'withpass'}).'</li>'; |
$output .= '<li>'.&mt('[quant,_1,file] require a passphrase for access.',$filecounts->{'withpass'}).'</li>'; |
} |
} |
$output .= '</ul>'; |
$output .= '</ul>'; |
} |
} |
Line 351 sub display_portfolio_header {
|
Line 351 sub display_portfolio_header {
|
|
|
sub display_portfolio_files { |
sub display_portfolio_files { |
my ($r,$lt) = @_; |
my ($r,$lt) = @_; |
my ($cdom,$cnum,$name) = aboutme_info($r); |
my ($cdom,$cnum,$name) = &aboutme_info($r); |
my $portaccess = 'withoutpass'; |
my $portaccess = 'withoutpass'; |
if (exists($env{'form.portaccess'})) { |
if (exists($env{'form.portaccess'})) { |
$portaccess = $env{'form.portaccess'}; |
$portaccess = $env{'form.portaccess'}; |
} |
} |
my $output = '<form name="displaystatus" method="post">'. |
my $output = '<form action="'.&HTML::Entities::encode($r->uri,'<>&"') |
&mt('File access type: ').'<select name="portaccess">'; |
.'" name="displaystatus" method="post">'. |
|
&mt('File access type: ').'<select name="portaccess">'; |
foreach my $type ('withoutpass','withpass','both') { |
foreach my $type ('withoutpass','withpass','both') { |
$output .= '<option value="'.$type.'" '; |
$output .= '<option value="'.$type.'" '; |
if ($portaccess eq $type) { |
if ($portaccess eq $type) { |
Line 367 sub display_portfolio_files {
|
Line 368 sub display_portfolio_files {
|
} |
} |
$output .= '</select>'."\n". |
$output .= '</select>'."\n". |
'<input type="submit" name="portaccessbutton" value="'. |
'<input type="submit" name="portaccessbutton" value="'. |
&mt('Update display').'">'. |
&mt('Update display').'" />'. |
'<input type="hidden" name="action" value="'. |
'<input type="hidden" name="action" value="'. |
$env{'form.action'}.'"/>'; |
$env{'form.action'}.'" />'; |
$output .= '</form><br /><br />'; |
$output .= '</form><br /><br />'; |
$r->print($output); |
$r->print($output); |
my $filecounts = &portfolio_files($r,'listfiles',$lt); |
my $filecounts = &portfolio_files($r,'listfiles',$lt); |
Line 445 sub portfolio_files {
|
Line 446 sub portfolio_files {
|
if ($mode eq 'listfiles') { |
if ($mode eq 'listfiles') { |
my $output; |
my $output; |
if (keys(%allfileshash) > 0) { |
if (keys(%allfileshash) > 0) { |
my $depth = 0; |
$output = &portfolio_table_start(); |
my $count = 0; |
$output .= &parse_directory($r,0,\%allfileshash); |
$output = '<table border="0" cellpadding="2" cellspacing="0">'; |
|
($count,$output) = &parse_directory($r,$output,$depth, |
|
\%allfileshash,$count); |
|
$output .= '</table>'; |
$output .= '</table>'; |
} else { |
} else { |
my $access_text; |
my $access_text; |
Line 463 sub portfolio_files {
|
Line 461 sub portfolio_files {
|
return $filecounts; |
return $filecounts; |
} |
} |
|
|
|
{ |
|
my $count=0; |
|
sub portfolio_table_start { |
|
$count=0; |
|
return '<table class="LC_aboutme_port">'; |
|
} |
|
sub portfolio_row_start { |
|
$count++; |
|
my $class = ($count%2)?'LC_odd_row' |
|
:'LC_even_row'; |
|
return '<tr class="'.$class.'">'; |
|
} |
|
} |
|
|
sub parse_directory { |
sub parse_directory { |
my ($r,$output,$depth,$currhash,$count) = @_; |
my ($r,$depth,$currhash) = @_; |
my ($cdom,$cnum,$name) = &aboutme_info($r); |
my ($cdom,$cnum,$name) = &aboutme_info($r); |
$depth ++; |
$depth++; |
my @backgroundColors = ("#FFFFFF", "#F6F6F6"); |
my $output; |
my $indent = '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace1.gif").'" width="25" height="1" alt=" " border="0" />'; |
|
$output .= $indent; |
|
foreach my $item (sort(keys(%{$currhash}))) { |
foreach my $item (sort(keys(%{$currhash}))) { |
$count ++; |
$output .= &portfolio_row_start(); |
my $backgroundcolor = $backgroundColors[$count%2]; |
$output .= '<td style="padding-left: '.($depth*25).'px">'; |
$output .= '<tr bgcolor="'.$backgroundcolor.'">'; |
|
$output .= '<td>'; |
|
for (my $i=0; $i<$depth; $i++) { |
|
$output .= $indent; |
|
} |
|
if (ref($currhash->{$item}) eq 'HASH') { |
if (ref($currhash->{$item}) eq 'HASH') { |
my $title = $item; |
my $title=&HTML::Entities::encode($item,'<>&"'); |
$title=~s/\"/\"/g; |
$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.' border="0" /> '.$title; |
$output .= '</td></tr>'; |
($count,$output) = &parse_directory($r,$output,$depth, |
$output .= &parse_directory($r,$depth,$currhash->{$item}); |
$currhash->{$item},$count); |
|
} else { |
} else { |
my $showname; |
my $showname; |
if ($currhash->{$item} =~ m|/([^/]+)$|) { |
if ($currhash->{$item} =~ m|/([^/]+)$|) { |
Line 491 sub parse_directory {
|
Line 495 sub parse_directory {
|
} else { |
} else { |
$showname = $currhash->{$item}; |
$showname = $currhash->{$item}; |
} |
} |
$output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" /> <a href="/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.$currhash->{$item}.'">'.$showname.'</a>'; |
$showname=&HTML::Entities::encode($showname,'<>&"'); |
|
$output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" /> <a href="/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.$currhash->{$item}.'">'.$showname.'</a>'; |
|
$output .= '</td></tr>'; |
} |
} |
$output .= '</td></tr>'; |
|
} |
} |
return ($count,$output); |
return $output; |
} |
} |
|
|
1; |
1; |