package org.jfox.framework.management.http;

/**
 * @author <a href="mailto:yangyong@ufsoft.com.cn">Young Yang</a>
 */

public class PageUtil {

    public static String head(String title) {
        StringBuffer sb = new StringBuffer();
        sb.append("<html>\n");
        sb.append("<head>\n");
        sb.append("<title>\n");
        sb.append(title);
        sb.append("</title>\n");
        sb.append("<style type=\"text/css\">\n");
        sb.append("P, DIV, TD, UL, LI, SPAN, BODY {\n");
        sb.append("font-family : verdana,arial,sans-serif;\n");
        sb.append("font-size : 9pt;\n");
        sb.append("}\n");
        sb.append("PRE {\n");
        sb.append("font-size : 9pt;\n");
        sb.append("}\n");

        sb.append("table.top-header {\n");
        sb.append("font-size: 12pt;\n");
        sb.append("font-weight : bold;\n");
        sb.append("font-family: verdana, arial, helvetica, sans-serif;\n");
        sb.append("color: #ddeedd;\n");
        sb.append("background-color: rgb(149, 149, 132);\n");
        sb.append("}\n");

        sb.append("table.top-header2 {\n");
        sb.append("font-size: 11pt;\n");
        sb.append("font-family: verdana, arial, helvetica, sans-serif;\n");
        sb.append("}\n");

        sb.append("table.top-menu {\n");
        sb.append("font-size: 11pt;\n");
        sb.append("font-family: verdana, arial, helvetica, sans-serif;\n");
        sb.append("background-color: #cccccc ;\n");
        sb.append("}\n");

        sb.append("table.outlet {\n");
        sb.append("background-color: #ffffff;\n");
        sb.append("padding: 0px;\n");
        sb.append("border: solid 1px #cccccc;\n");
        sb.append("margin: 0px;\n");
        sb.append("}\n");

        sb.append("table.form-outlet {\n");
        sb.append("background-color: #ffffff ;\n");
        sb.append("border-bottom: solid 4px #cccccc;\n");
        sb.append("}\n");

        sb.append(".paginator {\n");
        sb.append("font-size=: 15pt;\n");
        sb.append("}\n");

        sb.append("thead.browser {\n");
        sb.append("background-color: #336699;\n");
        sb.append("color: #ffffff;\n");

        sb.append("font-size=: 9pt;\n");
        sb.append("text-align : center;\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");


        sb.append("table.browser {\n");
        sb.append("background-color: #999999;\n");
        sb.append("}\n");

        sb.append("tr.browser {\n");
        sb.append("background-color: #ffffff ;\n");
        sb.append("}\n");

        sb.append(".title {\n");
        sb.append("text-align : left;\n");
        sb.append("background-color : #174E86;\n");
        sb.append("color : RGB(227,191,68);\n");
        sb.append("}\n");

        sb.append(".form-title {\n");

        sb.append("font-size : 9pt;\n");
        sb.append("text-align : left;\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");

        sb.append(".toolbar {\n");
        sb.append("text-align : left;\n");

        sb.append("}\n");

        sb.append(".editmodel-value {\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");

        sb.append("A {\n");
        sb.append("font-weight : bold;\n");
        sb.append("text-decoration : none;\n");
        sb.append("}\n");

        sb.append("A:hover {\n");
        sb.append("text-decoration : underline;\n");
        sb.append("}\n");

        sb.append("A.special {\n");
        sb.append("font-weight : normal;\n");
        sb.append("font-family : verdana,arial,sans-serif;\n");
        sb.append("font-size : 9pt;\n");
        sb.append("color : RGB(0,0,0);\n");
        sb.append("}\n");

        sb.append("A.head {\n");
        sb.append("font-weight : bold;\n");
        sb.append("font-family : verdana,arial,sans-serif;\n");
        sb.append("font-size : 12pt;\n");
        sb.append("color : none;\n");
        sb.append("}\n");

        sb.append("A.footer {\n");
        sb.append("color : null;\n");
        sb.append("}\n");

        sb.append("A.inverse {\n");
        sb.append("color : white;\n");
        sb.append("}\n");

        sb.append(".header {\n");
        sb.append("color : null;\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");
        sb.append(".subheader {\n");
        sb.append("color : null;\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");
        sb.append(".error {\n");
        sb.append("color : red;\n");
        sb.append("font-weight : bold;\n");
        sb.append("}\n");

        sb.append(".thead {\n");
        sb.append("background-color: #336699;\n");
        sb.append("color: #ffffff;\n");
        sb.append("text-decoration: none;\n");
        sb.append("font-size=: 9pt;\n");
        sb.append("text-align : center;\n");
        sb.append("font-weight : bold;\n");

        sb.append("}\n");
        sb.append("</style>\n");
        sb.append("</head>\n");
        sb.append("<body onload=\"focus();\" bgcolor=\"#ffffff\" link=\"#003399\" vlink=\"#003399\"  alink=\"#99ccff\">\n");

        sb.append("<table class=\"top-menu\" border=\"0\" width=\"760\" align=\"center\">\n");
        sb.append("<tr>\n");
        sb.append("<td>Welcome to <a href=\"http://www.huihoo.org/jfox/\" title=\"JFox J2EE Application Server\" target=\"_blank\">JFox</a> HtmlAdaptor Console</td>\n");
        sb.append("<td align=\"right\">\n");
        sb.append("<table class=\"top-menu\">\n");
        sb.append("<tr>\n");
        sb.append("<td align=\"right\" nowrap >\n");
        sb.append("<a class=\"inverse\" href=\"/\">First Page</a>\n");
        sb.append("|\n");
        sb.append("<a class=\"inverse\" href=\"?action=RegisterComponent\">Rigister Component</a>\n");
        sb.append("|\n");
        sb.append("<a class=\"inverse\" href=\"#\">Logout</a>\n");
        sb.append("</td>\n");
        sb.append("</tr>\n");
        sb.append("</table>\n");
        sb.append("</td>\n");

        sb.append("</tr>\n");
        sb.append("</table>\n");

/*    sb.append("<table class=\"top-header2\" border=\"0\" width=\"780\" align=\"center\">\n");
    sb.append("<tr width=\"100%\">\n");
    sb.append("<td>\n");

    sb.append("</td>\n");
    sb.append("<form method=\"GET\">\n");
    sb.append("<input type=hidden name=\"action\" value=\"Agent\">\n");
    sb.append("<td align=\"right\">\n");
    sb.append("Jump To Domain: <select name=\"domain\">");
    sb.append("<option value=\"*\">*");
    for(int i=0;i<domains.length;i++){
      sb.append("<option value=\"").append(domains[i]).append("\">").append(domains[i]);
    }
    sb.append("</select>");
    sb.append("<input type=\"submit\" value=\"Jump To\">\n");
    sb.append("</td>\n");
    sb.append("</form>\n");
    sb.append("</tr>\n");
    sb.append("</table>\n");*/

        return sb.toString();
    }


    public static String foot() {
        StringBuffer sb = new StringBuffer();
        sb.append("<table width=\"760\" align=\"center\">\n");
        sb.append("<tr>\n");
        sb.append("<td>\n");
        sb.append("<P>\n");
        sb.append("</td>\n");
        sb.append("</tr>\n");
        sb.append("</table>\n");

        sb.append("<p>\n");

        sb.append("<table cellpadding=\"6\" cellspacing=\"0\" border=\"0\" width=\"780\" align=\"center\">\n");
        sb.append("<tr>\n");
        sb.append("<hr size=\"1\" width=\"80%\" color=\"#666666\">\n");

        sb.append("<td align=\"center\">\n");
        sb.append("<a href=\"http://www.huihoo.org\" target=\"_blank\"><font size=\"-2\" face=\"verdana\" color=\"#666666\">Copyright (C) 2002 huihoo.org, All rights reserved.</font></a>\n");
        sb.append("</td>\n");
        sb.append("</tr>\n");
        sb.append("</table>\n");
        sb.append("</body>\n");
        sb.append("</html>");
        return sb.toString();
    }

    public static String banner(String ban) {
        StringBuffer sb = new StringBuffer();
        sb.append("<table width=\"760\" align=\"center\">\n");
        sb.append("<tr>\n");
        sb.append("<td><font size=4><b>").append(ban).append("</b></font></td>\n");
        sb.append("</tr>\n");
        sb.append("</table>\n");
        return sb.toString();
    }

    public static void main(String[] args) {

    }
}

