OpenIndex
view release on metacpan or search on metacpan
OpenIndex.pm view on Meta::CPAN
#Permission header
tagout('th',$cfg,'align="left"','Permission</th>') if $cfg->{options} & SHOW_PERMS;
#Owner header
tagout('th',$cfg,'align="left"','Owner</th>') if $args->{isadmin};
#Group header
if($args->{gid}) {
$msg=$args->{isadmin}?"Group":"Access";
tagout('th',$cfg,'align="left"',"$msg</th>");
}
#Select header
tagout('th',$cfg,'align="center"','Select</th>') if $mode;
#Icon header
tagout('th',$cfg,'align="left"','Icon</th>');
#Name, Last Modified, Size, and Description headers
foreach ('N', 'M', 'S', 'D') {
next if $cfg->{options} & SUPPRESS_LAST_MOD && $_ eq 'M';
next if $cfg->{options} & SUPPRESS_SIZE && $_ eq 'S';
next if $cfg->{options} & SUPPRESS_DESC && $_ eq 'D';
tagout('th',$cfg,'align="left"');
$msg=$lang->{$sortname{$_}} || $sortname{$_};
chomp($msg);
chomp($msg);
if(not $cfg->{options} & SUPPRESS_COLSORT) {
my $query;
if($args->{$_}) {
if($_ eq 'N') { # Name, can sort on extention
$query=($args->{$_} eq 'D')?'A':($args->{$_} eq 'A')?'E':'D';
} else {
$query = ($args->{$_} eq 'D')?'A':'D';
}
} else {
$query = 'A';
}
print qq~<a href="?$_=$query~,$args->{frame}?"&frame=$args->{frame}":'',qq~">~;
tagout('i',$cfg,'',"$msg</i></a>");
} else {
print $msg;
}
print "</th>\n";
}
print '</tr>';
#End of header
for my $entry (@$listing) {
my $stub;
my $label='';
my $isdir;
if($entry eq '..') {
next if $isroot;
$label=$lang->{Parent} || 'Parent Directory';
$isdir=1;
} else {
$label = $entry;
$label=~s:\..*::o if $cfg->{options} & HIDE_EXT;
}
my $img = $list->{$entry}{icon};
tagout('tr',$cfg,'align="left"');
#Permission data
tagout('td',$cfg,'',"$list->{$entry}{mode}</td>") if $cfg->{options} & SHOW_PERMS;
#Owner data
if($args->{isadmin}) {
my $pname=getpwuid($list->{$entry}{uid})||"$list->{$entry}{uid}";
tagout('td',$cfg,'',"${pname}</td>");
}
#Group data
if($args->{gid}) {
my $pname=getgrgid($list->{$entry}{gid})||"$list->{$entry}{gid}";
tagout('td',$cfg,'',"${pname}</td>");
}
if($mode && $entry eq '..') {
$stub=$args->{dir};
$stub=~s:/$::;
$stub=~s:.*/::;
}
$isdir=1 if $list->{$entry}{sizenice} eq '-';
#Select checkbox
if($mode) {
if($entry eq '..') {
print "<td></td>\n";
} else {
tagout('td',$cfg,'align="center"');
$msg=qq~TYPE="checkbox" name="${entry}"~;
$msg.=' checked' if $args->{all};
etagout('input',$cfg,$msg,'</td>');
}
}
#Icon
tagout('td',$cfg);
if($cfg->{options} & ICONS_ARE_LINKS) {
$msg=$args->{dir};
$msg=~s:/$cfg->{fakedir}/:/: if $mode & URI_ROOT && !$isdir;
$msg.=$entry;
$msg.='/' if $isdir;
$msg.="?frame=$args->{frame}" if $args->{frame};
if($mode) {
my $ac=$args->{frame}?'&':'?';
$msg.="${ac}child=$stub" if $stub;
$msg.='#main';
}
tagout('a',$cfg,qq~a href="$msg"~);
}
print
qq~<img width="$list->{$entry}{width}" height="$list->{$entry}{height}" src="$img" alt="[$list->{$entry}{alt}]" border="0" />~;
print "</a>" if ($cfg->{options} & ICONS_ARE_LINKS);
print "</td>\n";
#Name data
$msg=$args->{dir};
$msg=~s:/$cfg->{fakedir}/:/: if $mode & URI_ROOT && !$isdir;
tagout('td',$cfg);
$msg.=$entry;
$msg.='/' if $isdir;
$msg.="?frame=$args->{frame}" if $args->{frame};
if($mode) {
my $ac=$args->{frame}?'&':'?';
$msg.="${ac}child=$stub" if $stub;
$msg.='#main';
}
tagout('a',$cfg,qq~a href="$msg"~);
if($entry eq $args->{file}) { # selected file goes BOLD
print qq~<b>$label</b>\n~;
} else {
print qq~$label~;
( run in 1.593 second using v1.01-cache-2.11-cpan-39bf76dae61 )