<%@ page import="com.atlassian.jira.util.BuildUtils"%>
<%@ taglib uri="webwork" prefix="webwork" %>
<%@ taglib uri="webwork" prefix="ui" %>
<%@ taglib uri="sitemesh-page" prefix="page" %>
<html>
<head>
</head>

<body>

<webwork:if test="licenseUpdated == true">
    <page:applyDecorator name="jirapanel">
	    <page:param name="width">100%</page:param>
	    <page:param name="title">Update License</page:param>
        <page:param name="description">
            <font color=cc0000><b>Your license has been successfully updated. Please restart your server so that all necessary changes can take affect.
            <p>
            Changes will not take place until server is restarted.</b></font>
            <p>Click <a href="<%= request.getContextPath() %>/">here</a> when the server is restarted.
        </page:param>
    </page:applyDecorator>
</webwork:if>
<webwork:elseIf test="installationConfirmed == true">
    <page:applyDecorator name="jirapanel">
	    <page:param name="width">100%</page:param>
	    <page:param name="title">Update License</page:param>
        <page:param name="description">
            <font color=cc0000><b>The installation is complete. Please restart your server so that all necessary changes can take affect.
            <p>
            Changes will not take place until server is restarted.</b></font>
            <p>Click <a href="<%= request.getContextPath() %>/">here</a> when the server is restarted.
        </page:param>
    </page:applyDecorator>
</webwork:elseIf>
<webwork:else>
    <page:applyDecorator name="jiraform">
        <page:param name="action">ConfirmInstallationWithLicense.jspa</page:param>
        <page:param name="submitName">Proceed</page:param>
        <page:param name="width">100%</page:param>
        <page:param name="title">Confirm License Update</page:param>
        <page:param name="description">
            The current license is not compatible with this installation of JIRA.
            <p>
            <webwork:if test="buildPartnerNameExists == true">
                This version of JIRA (<%= BuildUtils.getVersion() %> - <font size="1">build #<%= BuildUtils.getCurrentBuildNumber() %></font>) requires a license generated by <b><webwork:property value="./buildPartnerName" /></b> - an Atlassian partner.
            </webwork:if>
            <webwork:else>
                This version of JIRA (<%= BuildUtils.getVersion() %> - <font size="1">build #<%= BuildUtils.getCurrentBuildNumber() %></font>) requires a license generated by Atlassian.
            </webwork:else>

            <p>
            Current license details:<br>
            <table class="borderedBox" bgcolor="fffff0">
                <webwork:property value="/licenseObject">
                    <tr><td><b>Organisation:</b>&nbsp;</td><td><webwork:property value="./organisation" /></td></tr>
                    <tr><td><b>License Type:</b>&nbsp;</td><td><webwork:property value="./licenseType" /></td></tr>
                    <webwork:if test="./partnerName != null && ./partnerName != ''">
                        <tr><td><b>Atlassian Partner:</b>&nbsp;</td><td><webwork:property value="./partnerName" /></td></tr>
                    </webwork:if>
                    <tr><td><b>Date Purchased:</b>&nbsp;</td><td><webwork:property value="/licensePurchaseDate" /></td></tr>
                </webwork:property>
            </table>
            <p>
            Please enter a valid license.
        </page:param>

        <ui:component label="'Admin User Name'" name="'userName'" template="userselect.jsp">
            <ui:param name="'formname'" value="'jiraform'" />
            <ui:param name="'imageName'" value="'userImage'"/>
            <ui:param name="'size'" value="40"/>
        </ui:component>

        <ui:component label="'Password'" name="'password'" template="password.jsp">
            <ui:param name="'size'">40</ui:param>
            <ui:param name="'description'">You must provide a valid Administrator username and password to proceed</ui:param>
        </ui:component>


        <tr>
            <td bgcolor="fffff0">&nbsp;</td>
            <td bgcolor="ffffff">&nbsp;</td>
        </tr>

        <page:param name="licenseString">Copy and paste the license key below.</page:param>

        <ui:component template="textlabel.jsp" label="text('admin.server.id')" value="/serverId"/>

        <ui:textarea label="'License'" name="'license'" cols="50" rows="10" >
            <ui:param name="'description'">
                <webwork:text name="'system.error.license.line1.desc'" /><br>
                <webwork:text name="'system.error.license.line2.desc'">
                    <webwork:param name="'value0'"><a target="_blank" href="<webwork:component name="'external.link.jira.license.view'" 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'"><webwork:property value="/serverId"/></webwork:param>
                </webwork:component>"></webwork:param>
                    <webwork:param name="'value1'"></a></webwork:param>
                </webwork:text>
            </ui:param>
        </ui:textarea>

    </page:applyDecorator>
</webwork:else>
</p>

</body>
</html>