gnump3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnump3d-devel] Fixes for playlist.pm


From: Michael Rensing
Subject: [Gnump3d-devel] Fixes for playlist.pm
Date: Wed, 06 Jul 2005 06:26:00 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Steve,

I've fixed the bug I reported in the playlist.pm plugin, as well as some modifications to "fix" the lists so that the plugin generates HTML compliant code. I've tested the resulting HTML using http://validator.w3.org. There are a few extra mods due to me messing around in the file. Mainly there should be three alterations:
- removed an unnecessary </input>
- added a loop to close all the open <ul> tags before the form buttons are added - replaced and "if" with a "while" to fix the bug where it didn't find all the directories if there are no songs in the directory.

Michael
*** gnump3d/lib/gnump3d/plugins/playlist.pm     2005-05-10 14:16:25.000000000 
-0700
--- /root/michaels_playlist.pm  2005-07-05 21:54:05.000000000 -0700
***************
*** 54,62 ****
  ##
  ###
  
- 
- 
- 
  #
  #  Return the author of this plugin.
  #
--- 54,59 ----
***************
*** 81,87 ****
  }
  
  
- 
  #
  #  Handle requests to this plugin - either display a form or process
  # the submission.
--- 78,83 ----
***************
*** 168,173 ****
--- 164,170 ----
  {
      # All the directories we find.
      my %DIRS = ();
+ print "In getDirectories\n";
  
      # The previous one.
      my $prev = "";
***************
*** 178,198 ****
          # Get just the filename
          my @NAMES    = split( /\t/, $line);
        my $fileName = shift(@NAMES);
- 
        # Get the directory name.
        if ( $fileName =~ /$ROOT\/(.*)\/(.*)$/ )
          {
            my $dir = $1;
            if ( $dir ne $prev )
            {
!               if ( $dir =~ /(.*)\/(.*)/ )
                {
                    $DIRS{ $1 } = 1;
                }
! 
!               $DIRS{$dir} = 1;
!           }
!           $prev = $dir;
        }
      }
    
--- 175,194 ----
          # Get just the filename
          my @NAMES    = split( /\t/, $line);
        my $fileName = shift(@NAMES);
        # Get the directory name.
        if ( $fileName =~ /$ROOT\/(.*)\/(.*)$/ )
          {
            my $dir = $1;
            if ( $dir ne $prev )
            {
!                 $DIRS{$dir} = 1;
!                 $prev = $dir;
!               while ( $dir =~ /(.*)\/(.*)/ )
                {
                    $DIRS{ $1 } = 1;
+                     $dir = $1
                }
!           } 
        }
      }
    
***************
*** 257,270 ****
            #
            my $prev  = 1;
            my $count = 0;
            my @DIRS = &getDirectories();
            foreach my $dir ( @DIRS )
            {
!               my $slashCount = scalar split( /\//, $dir );
  
                if ( $slashCount gt $prev )
                {
!                   $text .= "<ul>\n";
                }
                if ( $slashCount lt $prev )
                {
--- 253,268 ----
            #
            my $prev  = 1;
            my $count = 0;
+           my $slashCount = 0;
            my @DIRS = &getDirectories();
            foreach my $dir ( @DIRS )
            {
!               $slashCount = scalar split( /\//, $dir );
  
                if ( $slashCount gt $prev )
                {
!                   substr($text,rindex($text,"</li>"),5) = "<ul>\n";
! 
                }
                if ( $slashCount lt $prev )
                {
***************
*** 276,287 ****
              # 
              # Harry Nelson
              # 
!                       for ( my $dir_down = $prev - $slashCount;$dir_down gt 
0; $dir_down-- )
                        {
                            $text .= "</ul>\n";
                        }
                }
-               
                $prev =$slashCount;
                my $name = $dir ;
                
--- 274,285 ----
              # 
              # Harry Nelson
              # 
!                    for ( my $dir_down = $prev - $slashCount;$dir_down gt 0; 
$dir_down-- )
! 
                        {
                            $text .= "</ul>\n";
                        }
                }
                $prev =$slashCount;
                my $name = $dir ;
                
***************
*** 296,305 ****
                #
                $dir = &urlEncode( $dir );
  
!               $text .= "<li><input type=\"checkbox\" name=\"dir$count\" 
value=\"$dir\"> <a href=\"/$dir/\">$name</a> </input></li>\n";
                $count ++;
            }
!           $text .= "</ul>\n<input type=\"reset\" value=\"Clear All\"> <input 
type=\"submit\" value=\"Play\">\n";
            $text .= "</form>\n";
            $text .= $post;
        }
--- 294,307 ----
                #
                $dir = &urlEncode( $dir );
  
!               $text .= "<li><input type=\"checkbox\" name=\"dir$count\" 
value=\"$dir\"> <a href=\"/$dir/\">$name</a> </li>\n";
                $count ++;
            }
!             for ( my $dir_down = $slashCount;$dir_down gt 0; $dir_down-- )
!                 {
!                      $text .= "</ul>\n";
!                 }
!           $text .= "<input type=\"reset\" value=\"Clear All\"> <input 
type=\"submit\" value=\"Play\">\n";
            $text .= "</form>\n";
            $text .= $post;
        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]