<%@ page import="com.atlassian.jira.ComponentManager"%>
<%@ page import="com.atlassian.jira.ManagerFactory"%>
<%@ page import="com.atlassian.jira.config.properties.APKeys"%>
<%@ page import="com.atlassian.jira.config.properties.ApplicationProperties"%>
<%@ page import="com.atlassian.jira.config.properties.LookAndFeelBean"%>
<%@ page import="com.atlassian.jira.util.BuildUtils"%>
<%@ page import="com.atlassian.jira.web.action.util.JiraLicenseUtils"%>
<%@ page import="com.atlassian.license.License"%>
<%@ page import="com.atlassian.license.LicenseManager"%>
<%@ page import="com.atlassian.license.applications.jira.JiraLicenseTypeStore"%>
<%@ page import="com.atlassian.plugin.webresource.WebResourceManager" %>
<%@ taglib uri="sitemesh-decorator" prefix="decorator" %>
<%@ taglib uri="jiratags" prefix="jira" %>
<%@ taglib uri="webwork" prefix="webwork" %>
<%-- IF YOU EDIT THIS - BE SURE TO CHECK IF YOU NEED TO EDIT FOOTER.JSP --%>
<%
    ApplicationProperties ap = ManagerFactory.getApplicationProperties();
    final LookAndFeelBean lookAndFeelBeanFrontPage = LookAndFeelBean.getInstance(ap);
    String topBgColour = lookAndFeelBeanFrontPage.getTopBackgroundColour();
    String menuBgColour = lookAndFeelBeanFrontPage.getMenuBackgroundColour();
    String linkColour = lookAndFeelBeanFrontPage.getTextLinkColour();
    String linkAColour = lookAndFeelBeanFrontPage.getTextActiveLinkColour();

    //don't use default backed string here, as we will use the large logo
    String jiraLogo = lookAndFeelBeanFrontPage.getLogoUrl();
    if (jiraLogo != null && !jiraLogo.startsWith("http://") && !jiraLogo.startsWith("https://"))
    {
        jiraLogo = request.getContextPath() + jiraLogo;
    }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>JIRA - <decorator:title default="New Generation Issue Tracking" /></title>
    <META http-equiv="Content-Type" content="<%= ap.getContentType() %>">
	<%@ include file="/includes/decorators/stylesheettag.jsp" %>
    <script language="JavaScript" type="text/javascript" src="<%=request.getContextPath()%>/includes/js/combined-javascript.js"></script>
<%
    WebResourceManager webResourceManager = ComponentManager.getInstance().getWebResourceManager();
    webResourceManager.includeResources(out);
%>
</head>

<body bgcolor="#f0f0f0" style="margin: 0" link="<%= linkColour %>" vlink="<%= linkColour %>" alink="<%= linkAColour %>">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="height: 100%">
<tr valign="middle"><td>

<table cellpadding="0" cellspacing="0" class="centred borderedBoxBlack" width="400">
    <tr>
        <td width="400" bgcolor="<%= topBgColour %>"><table><tr>
            <td valign="bottom" width="200"><a href="<%= request.getContextPath() %>/secure/"><% if (jiraLogo == null) { %><img src="<%= request.getContextPath() %>/images/jira_logo_small.gif" width="111" height="30" border="0" alt="<%= ap.getString(APKeys.JIRA_TITLE) %>" vspace="0" hspace="0"><% } else { %><img src="<%= jiraLogo %>" width="<%= lookAndFeelBeanFrontPage.getLogoWidth() %>" height="<%= lookAndFeelBeanFrontPage.getLogoHeight() %>" border=0 alt="<%= ap.getString(APKeys.JIRA_TITLE) %>"><% } %></a></td>
            <td valign="bottom" width="200" align="right">
                <webwork:component name="'default'" template="help.jsp">
                    <webwork:param name="'align'" value="'middle'"/>
                </webwork:component>
                &nbsp;
            </td>
        </tr></table></td>
    </tr>
    <tr style="height: 5px;">
      	<td width="400" bgcolor="<%= menuBgColour %>"><img src="<%= request.getContextPath() %>/images/border/spacer.gif" width="5" height="5" border="0" alt=""></td>
    </tr>
    <tr>
        <td bgcolor="<%= topBgColour %>">
            <decorator:body />
        </td>
    </tr>
</table>

<br/>

<div class="fullyCentered">
    <span class="small">
<%
    boolean longFooterMessage = true;
    License curLicense = null;
    if (JiraLicenseUtils.isLicenseSetup())
    {
        curLicense = LicenseManager.getInstance().getLicense(JiraLicenseUtils.JIRA_LICENSE_KEY);
    }

    // UNLICENSED
    if (curLicense == null)
    { %>
Please request a 30-day <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA evaluation license</a> online today.
<%
    }
    // CONFIRMED WITH OLD LICENSE
    else if (ManagerFactory.getApplicationProperties().getOption(APKeys.JIRA_CONFIRMED_INSTALL_WITH_OLD_LICENSE))
    {
%>
Are you enjoying this new version of JIRA?
Please consider <a href="<webwork:component name="'external.link.jira.license.extend.from.old'" template="externallink.jsp" >
    <webwork:param name="'value0'"><%= BuildUtils.getVersion() %></webwork:param>
    <webwork:param name="'value1'"><%= BuildUtils.getCurrentBuildNumber() %></webwork:param>
    <webwork:param name="'value2'"><%= BuildUtils.getEdition() %></webwork:param>
    <webwork:param name="'value3'"><%= JiraLicenseUtils.getServerId() %></webwork:param>
</webwork:component>">extending your license</a> today.
<%
    }
    // EVALUATION
    else if (JiraLicenseTypeStore.JIRA_STANDARD_EVALUATION.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_EVALUATION.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_EVALUATION.equals(curLicense.getLicenseType()))
    {
        longFooterMessage = false;
%>
Powered by a free Atlassian <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA evaluation license</a>.
Please consider <a href="<webwork:component name="'external.link.jira.license.purchase.from.evaluation'" template="externallink.jsp" >
    <webwork:param name="'value0'"><%= BuildUtils.getVersion() %></webwork:param>
    <webwork:param name="'value1'"><%= BuildUtils.getCurrentBuildNumber() %></webwork:param>
    <webwork:param name="'value2'"><%= BuildUtils.getEdition() %></webwork:param>
    <webwork:param name="'value3'"><%= JiraLicenseUtils.getServerId() %></webwork:param>
</webwork:component>">purchasing it</a> today.
<%
    }
    // NON-PROFIT
    else if (JiraLicenseTypeStore.JIRA_STANDARD_NON_PROFIT.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_NON_PROFIT.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_NON_PROFIT.equals(curLicense.getLicenseType()))
    {
        longFooterMessage = false;
%>
Powered by a free Atlassian <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA</a> non-profit license for <%= curLicense.getOrganisation() %>.
Try JIRA - <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">bug tracking software</a> for <i>your</i> team.
<%
    }
    // COMUNITY
    else if (JiraLicenseTypeStore.JIRA_STANDARD_COMMUNITY.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_COMMUNITY.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_COMMUNITY.equals(curLicense.getLicenseType()))
    {
        longFooterMessage = false;
%>
Powered by a free Atlassian <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA</a> community license for <%= curLicense.getOrganisation() %>.
Try JIRA - <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">bug tracking software</a> for <i>your</i> team.
<%
    }
    // OPEN-SOURCE
    else if (JiraLicenseTypeStore.JIRA_STANDARD_OPEN_SOURCE.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_OPEN_SOURCE.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_OPEN_SOURCE.equals(curLicense.getLicenseType()))
    {
        longFooterMessage = false;
%>
Powered by a free Atlassian <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA</a> open source license for <%= curLicense.getOrganisation() %>.
Try JIRA - <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">bug tracking software</a> for <i>your</i> team.
<%
    }
    // DEMONSTRATION
    else if (JiraLicenseTypeStore.JIRA_STANDARD_DEMONSTRATION.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEMONSTRATION.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_DEMONSTRATION.equals(curLicense.getLicenseType()))
    {
%>
This JIRA site is for demonstration purposes only.
<a href="<webwork:component name="'external.link.jira.license.evaluate.from.unlicensed'" template="externallink.jsp" >
    <webwork:param name="'value0'"><%= BuildUtils.getVersion() %></webwork:param>
    <webwork:param name="'value1'"><%= BuildUtils.getCurrentBuildNumber() %></webwork:param>
    <webwork:param name="'value2'"><%= BuildUtils.getEdition() %></webwork:param>
    <webwork:param name="'value3'"><%= JiraLicenseUtils.getServerId() %></webwork:param>
</webwork:component>">Evaluate JIRA</a> - bug tracking software for your team.
<%
    }
    // DEVELOPER
    else if (JiraLicenseTypeStore.JIRA_STANDARD_DEVELOPER.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEVELOPER.equals(curLicense.getLicenseType())
            || JiraLicenseTypeStore.JIRA_ENTERPRISE_DEVELOPER.equals(curLicense.getLicenseType()))
    {
%>
This <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA</a> site is for non-production use only.
<%
    }
%>
<br/>
<%-- GREY FOOTER - START --%>
<span class="smallfooter">
<% if (longFooterMessage) { %>Powered by <% } %><a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">Atlassian JIRA</a>
the Professional <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">Issue Tracker</a>.
<span class="smallgreyfooter">(<%= BuildUtils.getBuildInformation() %>)</span><br/>
<a href="<webwork:component name="'external.link.jira.raise.issue'" template="externallink.jsp"/>">Bug/feature request</a>
- <a href="<%= request.getContextPath() %>/secure/Administrators.jspa">Contact Administrators</a>
</span>
<%-- GREY FOOTER - END --%>

    </span>
</div>

</td></tr>
</table>

</body>
</html>
