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

[THREDDS #IZW-298295]: Customise TDS [SEC=UNCLASSIFIED]



>Hi Lansing,
>
>I have unpacked the thredds.war file but I couldn't found htmlwriter.java as 
>you mentioned. Can you please instruct me where to look for? Under that war 
>file there is no *.java file, however there are class >files but I can not 
>edit it. 
>
>Cheers,
>Ken Toch

Ken,

I misspoke - I was thinking of unpacking a .jar file, not a .war file.  In 
order to change HtmlWriter.java, you will need to pull down the source code 
from our repository on github:

https://github.com/Unidata/thredds

Then, you will be able to go into HtmlWriter.java and modify the 
appendSimpleFooter() method to make a footer:

private void appendSimpleFooter( StringBuilder sb )
  {
    sb.append( "<h3>" );
    if ( this.htmlConfig.getInstallName() != null )
    {
      String installUrl = this.htmlConfig.prepareUrlStringForHtml( 
this.htmlConfig.getInstallUrl() );
      if ( installUrl != null )
        sb.append( "<a href='" ).append( installUrl ).append( "'>" );
      sb.append( this.htmlConfig.getInstallName() );
      if ( installUrl != null )
        sb.append( "</a>" );
    }
    if ( this.htmlConfig.getHostInstName() != null )
    {
      sb.append( " at " );
      String hostInstUrl = this.htmlConfig.prepareUrlStringForHtml( 
this.htmlConfig.getHostInstUrl() );
      if ( hostInstUrl != null )
        sb.append( "<a href='" ).append( hostInstUrl ).append( "'>" );
      sb.append( this.htmlConfig.getHostInstName() );
      if ( hostInstUrl != null )
        sb.append( "</a>" );
      sb.append( "<br>\n" );
    }
    sb.append( this.tdsContext.getWebappName() )
            .append( " [Version " ).append( this.tdsContext.getWebappVersion() 
);
    if ( this.tdsContext.getWebappVersionBuildDate() != null )
      sb.append( " - " ).append( this.tdsContext.getWebappVersionBuildDate() );
    sb.append( "] <a href='" )
            .append( this.htmlConfig.prepareUrlStringForHtml( 
this.htmlConfig.getWebappDocsUrl() ) )
            .append( "'> Documentation</a>" );
    sb.append( "</h3>\n" );
  }

Essentially, you will want to do something like this:

private void appendSimpleFooter( StringBuilder sb )
  {
    sb.append("<div id=\"footer\">");
    sb.append("THIS IS MY FOOTER");
    sb.append("\div");
} 

Similarly, you can do your header by editing the 
convertCatalogToHtml(InvCatalogImpl cat, boolean isLocalCatalog) method.

Cheers,
  Lansing Madry
  Unidata
  Boulder, Colorado

Ticket Details
===================
Ticket ID: IZW-298295
Department: Support THREDDS
Priority: High
Status: Open