<%@ page import="com.atlassian.jira.ManagerFactory"%>
<%@ page import="com.atlassian.jira.config.properties.APKeys"%>
<%@ 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" %>
<%@ taglib uri="webwork" prefix="webwork" %>
<%-- IF YOU EDIT THIS - BE SURE TO CHECK IF YOU NEED TO EDIT DECORATORS/FRONTPAGE.JSP --%>

<%
    boolean longFooterMessage = true;
    License curLicense = null;
    if (JiraLicenseUtils.isLicenseSetup())
    {
        curLicense = LicenseManager.getInstance().getLicense(JiraLicenseUtils.JIRA_LICENSE_KEY);
    }
%>
<div class="footer">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<%
    if (curLicense == null
            || !JiraLicenseTypeStore.JIRA_STANDARD_FULL_LICENSE.equals(curLicense.getLicenseType())
            || !JiraLicenseTypeStore.JIRA_PROFESSIONAL_FULL_LICENSE.equals(curLicense.getLicenseType())
            || !JiraLicenseTypeStore.JIRA_ENTERPRISE_FULL_LICENSE.equals(curLicense.getLicenseType())
            || ManagerFactory.getApplicationProperties().getOption(APKeys.JIRA_CONFIRMED_INSTALL_WITH_OLD_LICENSE))
    {
%>
<tr>
	<td bgcolor="#bbbbbb"><img src="<%= request.getContextPath() %>/images/border/spacer.gif" height="1" width="100" border="0" alt=""></td>
</tr>
<%
        // UNLICENSED
        if (curLicense == null)
        {
%>
<tr><td class="licensemessagered">
    Please request a 30-day <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>">JIRA evaluation license</a> online today.
</td></tr>
<%
        }
        // 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;
%>
<tr><td class="licensemessagered">
    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.
</td></tr>
<%
        }
        // CONFIRMED WITH OLD LICENSE
        else if (ManagerFactory.getApplicationProperties().getOption(APKeys.JIRA_CONFIRMED_INSTALL_WITH_OLD_LICENSE))
        {
%>
<tr><td class="licensemessagered">
    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.
</td></tr>
<%
        }
        // COMMUNITY
        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;
%>
<tr><td class="licensemessage">
    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.
</td></tr>
<%
        }
        // 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;
%>
<tr><td class="licensemessage">
    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.
</td></tr>
<%
        }
        // 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;
%>
<tr><td class="licensemessage">
    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.
</td></tr>
<%
        }
        // DEMONSTRATION
        else if (JiraLicenseTypeStore.JIRA_STANDARD_DEMONSTRATION.equals(curLicense.getLicenseType())
                || JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEMONSTRATION.equals(curLicense.getLicenseType())
                || JiraLicenseTypeStore.JIRA_ENTERPRISE_DEMONSTRATION.equals(curLicense.getLicenseType()))
        {
%>
<tr><td class="licensemessage">
    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.
</td></tr>
<%
        }
        // DEVELOPER
        else if (JiraLicenseTypeStore.JIRA_STANDARD_DEVELOPER.equals(curLicense.getLicenseType())
                || JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEVELOPER.equals(curLicense.getLicenseType())
                || JiraLicenseTypeStore.JIRA_ENTERPRISE_DEVELOPER.equals(curLicense.getLicenseType()))
        {
%>
<tr><td class="licensemessage">
    This <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">JIRA</a> site is for non-production use only.
</td></tr>
<%
        }
    }
%>
<tr>
    <td height="12" style="background-image:url(<%= request.getContextPath() %>/images/border/border_bottom.gif)"><img src="<%= request.getContextPath() %>/images/border/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
</table>

<span class="poweredbymessage">
<% if (longFooterMessage) { %>Powered by <% } %><a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />" class="smalltext">Atlassian JIRA</a>
the Professional <a href="<webwork:component name="'external.link.jira.product.site'" template="externallink.jsp" />">Issue Tracker</a>.
<span style="color: #666666;">(<%= BuildUtils.getBuildInformation() %>)</span>
- <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>

</div><%-- footer --%>
</body>
</html>
