modification to DirectoryResource.java

Hello,

I was a little disturbed by the default handling of the  
DirectoryResource.java getDirectoryListing code.  The <pre> works well, but I  
like the layout options of <table> much better.

The following diff allows all directory outputs to be viewed as a three  
column table.

Regards,
jas

-------------------- < snip here > --------------------

beauregard> diff DirectoryResource.java.orig DirectoryResource.java
697,698c697,698
<           g.append("<h1>"+getIdentifier()+"</h1>");
<           g.append("<pre>");
---
>           g.append("<h1>"+getIdentifier()+"</h1>\n");
>           g.append("<table width=\"100%\" border=0 cellpadding=0  
cellspacing=0>\n");
700,714c700,724
<               String       name     = (String) resources.elementAt(i);
<               HTTPResource resource = lookupStore(name);
<               String       icon     = resource.getIcon() ;
<               // Icon first, if available
<               if ( icon != null )
<                   g.append("<img src=\""
<                            + getIconDirectory() +"/" + icon
<                            + "\">");
<               // Resource's name with link:
<               g.append("<a href=\"" + resource.getURL() + "\">"+name+"</a>");
<               // resource's title, if any:
<               String title = resource.getTitle();
<               if ( title != null )
<                   g.append(" "+title);
<               g.append("\r\n");
---
>                       String       name     = (String) resources.elementAt(i);
>                       HTTPResource resource = lookupStore(name);
>                       String       icon     = resource.getIcon();
>
>                       // Prepare for new row
>                       g.append("<tr>\n");
>
>                       // Icon first, if available
>                       if ( icon != null ) {
>                           g.append("<th><img src=\""
>                                    + getIconDirectory() +"/" + icon
>                                    + "\"></th>");
>                       } else {
>                               g.append("<th></th>\n");
>                       }
>                       // Resource's name with link:
>                       g.append("<th align=left><a href=\"" +  
resource.getURL() + "\">"+name+"</a></th>\n");
>                       // resource's title, if any:
>                       String title = resource.getTitle();
>                       if ( title != null ) {
>                           g.append("<td align=left>" + title + "</td>\n");
>                       } else {
>                               g.append("<td></td>\n");
>                       }
>                       g.append("</tr>\n");
716c726
<           g.append("</pre>");
---
>           g.append("</table>");

Received on Monday, 2 December 1996 16:19:16 UTC