/*
* [CoFoot.java]
*
* Summary: Generate the footer for Cherokee Obama page.
*
* Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
*
* Licence: This software may be copied and used freely for any purpose but military.
* http://mindprod.com/contact/nonmil.html
*
* Requires: JDK 1.8+
*
* Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
*
* Version History:
* 1.8 2009-02-06 include go package in ZIP bundle.
*/
package com.mindprod.htmlmacros.macro;
import com.mindprod.fastcat.FastCat;
import com.mindprod.htmlmacros.support.BuildImage;
import com.mindprod.htmlmacros.support.ImageAlignment;
import com.mindprod.htmlmacros.support.Tools;
import static com.mindprod.htmlmacros.macro.Global.configuration;
import static java.lang.System.*;
/**
* Generate the footer for Cherokee Obama page.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2010-01-23 initial cloned from Foot.
* @since 2010-01-23
*/
public final class CoFoot extends Macro
{
/**
* text to describe user's face IP
*/
private static final String FACE_IP = "Your face IP:[]";
/**
* Usual HTML for an href.
*/
private static final String PLAIN_HREF = ""
+ configuration.getWebsiteDomain()
+ " IP:["
+ configuration.getWebsiteIP()
+ "]";
/**
* suffix for a tag
*/
private static final String TAG_TAIL = configuration.getTagTail();
/**
* how to use the macro
*/
private static final String USAGE = "\nCoFoot macro takes no parameters";
/**
* Build button to get to home page
*
* @param homeLink link to home page
*
* @return HTML expansion
*/
private String buildHomeButton( final String homeLink )
{
final FastCat sb = new FastCat( 6 );
sb.append( PLAIN_HREF );
sb.append( "\"" );
sb.append( homeLink );
sb.append( "\">" );
sb.append( BuildImage.buildImgTag( "navigate/home.png",
"home",
ImageAlignment.middle,
null,
fileBeingDistributed ) );
sb.append( "" );
return sb.toString();
}
/**
* Build logo
*
* @param homeLink link to home page
*
* @return HTML expansion
*/
private String buildLogoImage( final String homeLink )
{
final FastCat sb = new FastCat( 6 );
sb.append( PLAIN_HREF );
sb.append( "\"" );
sb.append( homeLink );
sb.append( "\">" );
sb.append( BuildImage.buildImgTag( "logo/" + configuration.getCompanyLogo(),
configuration.getCompanyName(),
ImageAlignment.middle,
null,
fileBeingDistributed ) );
sb.append( "" );
return sb.toString();
}
/**
* Build button that links to the next page.
*
* @return HTML expansion
*/
private String buildNextButton()
{
// calculate next link based on filename
final FastCat sb = new FastCat( 6 );
sb.append( PLAIN_HREF );
sb.append( "\"" );
sb.append( configuration.calcNextPage( fileBeingDistributed ) );
sb.append( "\">" );
sb.append( BuildImage.buildImgTag( "navigate/next.png",
"next page",
ImageAlignment.middle,
null,
fileBeingDistributed ) );
sb.append( "" );
return sb.toString();
}
/**
* Build Post on blog.
*
* @return HTML expansion
*/
private String buildPostOnBlog()
{
final String blogURL = configuration.blogForPage( fileBeingDistributed );
if ( blogURL.length() == 0 )
{
return "";
}
final FastCat sb = new FastCat( 10 );
sb.append( "" );
sb.append( BuildImage.buildImgTag( "navigate/blogger.png",
"blogger",
ImageAlignment.middle,
"plain",
fileBeingDistributed ) );
sb.append( " You may post public comments about);" );
sb.append( configuration.getBr() );
sb.append( "Dreaming Gods of Gaia on the blog at :\n" );
sb.append( "" );
sb.append( blogURL );
sb.append( "\n" );
return sb.toString();
}
/**
* Build button that links to the previous page.
*
* @return HTML expansion
*/
private String buildPrevButton()
{
// calculate next link based on filename
final FastCat sb = new FastCat( 6 );
sb.append( PLAIN_HREF );
sb.append( "\"" );
sb.append( configuration.calcPrevPage( fileBeingDistributed ) );
sb.append( "\">" );
sb.append( BuildImage.buildImgTag( "navigate/prev.png",
"prev page",
ImageAlignment.middle,
null,
fileBeingDistributed ) );
sb.append( "" );
return sb.toString();
}
/**
* Build Please give feedback block.
*
* @return HTML expansion
*/
private String buildPrivateFeedback()
{
final FastCat sb = new FastCat( 7 );
sb.append( "" );
sb.append( BuildImage.buildImgTag( "navigate/feedback.png",
"feedback",
ImageAlignment.middle,
"plain",
fileBeingDistributed ) );
sb.append(
" Please email your private feedback, errors, omissions, typos, " +
"formatting errors, suggestions to improve this novel or comments to\n"
);
sb.append( configuration.getAuthor() );
sb.append( " :\n" );
sb.append( BuildImage.buildImgTag( "mailto/feedback.png",
"feedback email",
null,
"mailto",
fileBeingDistributed ) );
sb.append( "" );
return sb.toString();
}
/**
* Build button that takes you back to top of page.
*
* @return expanded HTML text for button
*/
private String buildToTopButton()
{
final FastCat sb = new FastCat( 4 );
sb.append( PLAIN_HREF );
sb.append( "\"#TOP\">" );
sb.append( BuildImage.buildImgTag( "navigate/totop.png",
"jump to top",
ImageAlignment.middle,
null,
fileBeingDistributed ) );
sb.append( "\n" );
return sb.toString();
}
/**
* guts to Generate the footer for an amanuensis html document.
*
* @return expanded footer
*/
private String expand()
{
// At this point have dir without lead or trail /, possibly ""
if ( configuration.isKindle() )
{
return "