--- loncom/interface/portfolio.pm 2004/07/23 01:25:56 1.16
+++ loncom/interface/portfolio.pm 2004/07/27 05:29:00 1.17
@@ -56,14 +56,14 @@ sub displayDirectory {
$upPath = $1;
}
- $displayOut = $displayOut.'..
';
+ # $displayOut = $displayOut.'..
';
} else {
- $displayOut = $displayOut.'at root '.$currentPath.'
';
+ # $displayOut = $displayOut.'at root '.$currentPath.'
';
}
foreach my $line (@dirList) {
#$strip holds directory/file name
#$dom
- my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef,$path)=split(/\&/,$line,17);
+ my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef,$path,$debug)=split(/\&/,$line,18);
$path =~ m:/:;
my $dirDepth = @-;
if (($fileName ne '.') && ($fileName ne '..')){
@@ -73,15 +73,15 @@ sub displayDirectory {
if ($testdir =~ m:^1:){
# handle directories different from files
if ($fileName eq $currentFile){ #checks to bold the selected file
- $displayOut.= ''.(makeAnchor($fileName.'/', $path.$fileName.'/').'
'."\n");
+ $displayOut.= $debug.''.(makeAnchor($fileName.'/', $path.$fileName.'/').'
'."\n");
}else{
- $displayOut.= (makeAnchor($fileName.'/', $path.$fileName.'/').'
'."\n");
+ $displayOut.= $debug.(makeAnchor($fileName.'/', $path.$fileName.'/').'
'."\n");
}
}else{
if ($fileName eq $currentFile){ #checks to bold the selected file
- $displayOut.=''.(makeAnchor($fileName, $currentPath).'
'."\n");
+ $displayOut.=$debug.''.(makeAnchor($fileName, $currentPath).'
'."\n");
}else{
- $displayOut.=(makeAnchor($fileName, $currentPath).'
'."\n");
+ $displayOut.=$debug.(makeAnchor($fileName, $currentPath).'
'."\n");
}
}
for (my $i = 0; $i <= $dirDepth; $i += 1){
@@ -243,22 +243,29 @@ sub handler {
if ($readDirectory){ # is true the first time through, then true if dirlist line is a subdir
# $r->print('
reading '.$portfolio_root.$subdir);
my @list = &Apache::lonnet::dirlist($currentPath, $ENV{'user.domain'}, $ENV{'user.name'}, $portfolio_root.$subdir);
- foreach my $line(@list){
- $line = $line.'&'.$subdir; # append the subdirectory information
+ $r->print('value in @list = '.@list);
+ for (my $i = 0; $i <= @list; $i++ ){
+ my $line = pop @list;
+ $line = $line.'&'.$subdir.'&'.$loopCounter; # append the subdirectory information and loopcounter for debug
my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef,$subpath)=split(/\&/,$line,17);
if (($fileName ne '.') && ($fileName ne '..')){ # we throw away the current and parent directories
- $r->print('
'.$line);
- # should this be shift?
- push @workinglist, $line; # add the line to the working list array
+ $r->print('
'.$line); #for debugging
+ unshift @workinglist, $line; # add the line to the working list array
+
+ }else{
+ $r->print('
parent or current '.$line); #for debugging
}
}
}
+ $r->print('
'.@workinglist.' lines in workinglist');
my $line = shift @workinglist; #take one off the working list
+ $r->print('
'.@workinglist.' lines in workinglist');
if ($line eq '') { # if the working list is empty
$done = 1;
}else{
+ my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef,$subpath,$debug)=split(/\&/,$line,18);
+ $r->print('
'.$fileName.' is '.$testdir);
push @dirList, $line; # and put it in the display list
- my ($fileName,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef,$subpath)=split(/\&/,$line,17);
if ($testdir =~ m:^1:) { # true if this is a directory
# $r->print('
added subdir '.$fileName);
$subdir = $subpath.'/'.$fileName;