--- loncom/interface/portfolio.pm 2004/07/29 17:04:21 1.20
+++ loncom/interface/portfolio.pm 2004/09/06 23:59:05 1.37
@@ -32,27 +32,27 @@ use Apache::lonlocal;
# receives a file name and path stub from username/userfiles/portfolio/
# returns an anchor tag consisting encoding filename and currentpath
-sub makeAnchor{
- my ($fileName, $currentPath) = @_;
- my $anchor = ''.$fileName.'';
+sub make_anchor {
+ my ($filename, $current_path) = @_;
+ my $anchor = ''.$filename.'';
return $anchor;
}
# returns html with
separated contents of the directory
# returns a currentFile (bolds the selected file/dir)
-sub displayDirectory {
+sub display_directory_old {
my ($currentPath, $currentFile, @dirList,) = @_;
my $displayOut='';
- my $fileName;
+ my $filename;
my $upPath;
- if ($currentPath ne '/'){
- $displayOut = 'Listing of '.$currentPath.'
'.
+ if ($currentPath ne '/') {
+ $displayOut = 'Listing of '.$currentPath.'
';
# provides the "up one directory level" function
# it means shortening the currentpath to the parent directory
$currentPath =~ m:(^/.*)(/.*/$):;
- if ($1 ne '/'){
+ if ($1 ne '/') {
$upPath = $1.'/';
- }else{
+ } else {
$upPath = $1;
}
@@ -63,20 +63,22 @@ sub displayDirectory {
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)=split(/\&/,$line,16);
- if (($fileName ne '.') && ($fileName ne '..')){
- if ($testdir =~ m:^1:){
+ my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);
+ if (($filename ne '.') && ($filename ne '..')) {
+ if ($testdir =~ m:^1:) {
# handle directories different from files
- if ($fileName eq $currentFile){ #checks to bold the selected file
- $displayOut.= ''.(makeAnchor($fileName.'/', $fileName.'/').'
'."\n");
- }else{
- $displayOut.= (makeAnchor($fileName.'/', $fileName.'/').'
'."\n");
+ if ($filename eq $currentFile) {
+ #checks to bold the selected file
+ $displayOut.= ''.(&make_anchor($filename.'/', $filename.'/').'
'."\n");
+ } else {
+ $displayOut.= (&make_anchor($filename.'/', $filename.'/').'
'."\n");
}
- }else{
- if ($fileName eq $currentFile){ #checks to bold the selected file
- $displayOut.=''.(makeAnchor($fileName, $currentPath).'
'."\n");
- }else{
- $displayOut.=(makeAnchor($fileName, $currentPath).'
'."\n");
+ } else {
+ if ($filename eq $currentFile) {
+ #checks to bold the selected file
+ $displayOut.=''.(&make_anchor($filename, $currentPath).'
'."\n");
+ } else {
+ $displayOut.=(&make_anchor($filename, $currentPath).'
'."\n");
}
}
@@ -85,12 +87,13 @@ sub displayDirectory {
}
return $displayOut;
}
+
sub displayActions {
# returns html to offer user appropriate actions depending on selected file/directory
my $displayOut;
my ($currentPath, $currentFile, $isEmpty) = @_;
# $displayOut = 'here are actions for '.$currentFile;
- if ($currentFile =~ m:/$:){
+ if ($currentFile =~ m:/$:) {
# if the selected file is a directory, these are the options
# offer the chance to delete the directory only if it is empty
if ($isEmpty && ($currentPath ne '/')) {
@@ -117,7 +120,7 @@ sub displayActions {
value="Rename '.$currentFile.'" />
';
}
- }else{ #action options offered for files
+ } else { #action options offered for files
$displayOut = $displayOut.'