<%@ page import="com.atlassian.jira.util.EasyList,
                 com.atlassian.jira.web.action.util.JiraLicenseUtils,
                 com.atlassian.license.License,
                 com.atlassian.license.LicenseManager"%>
<%@ taglib uri="webwork" prefix="webwork" %>

<% License license = LicenseManager.getInstance().getLicense(JiraLicenseUtils.JIRA_LICENSE_KEY);
    if (license !=null && license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL, JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL))) { %>
<strong><webwork:text name="'admin.projects.issue.type.scheme'"/>: </strong> <webwork:property value="/issueTypeScheme/name" />
<webwork:if test="/hasAdminPermission == true">
(
<a id="selectIssueTypeScheme"
   href="<webwork:url page="SelectIssueTypeSchemeForProject!default.jspa">
            <webwork:param name="'projectId'" value="long('id')" />
            <webwork:param name="'returnUrl'" >/secure/project/ViewProject.jspa?pid=<webwork:property value="long('id')" /></webwork:param>
         </webwork:url>"><webwork:text name="'common.words.select'"/></a> |
<a id="editCurrentIssueTypeScheme"
   href="<webwork:url page="/secure/admin/ConfigureOptionSchemes!default.jspa">
            <webwork:param name="'fieldId'" value="'issuetype'" />
            <webwork:param name="'schemeId'" value="/issueTypeScheme/id" />
            <webwork:param name="'projectId'" value="long('id')" />
            <webwork:param name="'returnUrl'" >/secure/project/ViewProject.jspa?pid=<webwork:property value="long('id')" /></webwork:param>
         </webwork:url>"><webwork:text name="'common.words.edit'"/></a> |
<a id="manageIssueTypeSchemes"
   href="<webwork:url page="/secure/admin/ManageIssueTypeSchemes!default.jspa">
         </webwork:url>"><webwork:text name="'admin.projects.manage.issue.type.scheme'"/></a>
)
</webwork:if>
<% } %>

<br />
<%-- Notification Schemes --%>
<b><webwork:text name="'admin.projects.notification.scheme'"/>:</b>
<webwork:if test="schemes != null && schemes/size > 0">
	<webwork:iterator value="schemes" status="'liststatus'">
		<webwork:property value="string('name')" />
		<webwork:if test="@liststatus/last == false">, </webwork:if>
	</webwork:iterator>
	<webwork:if test="/hasAdminPermission == true">
		(
		<a href="<webwork:url page="SelectProjectScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
		|
		<a href="<webwork:url page="EditNotifications!default.jspa"><webwork:param name="'schemeId'" value="schemes/(0)/long('id')"/></webwork:url>"><webwork:text name="'common.words.edit'"/></a>
		)
	</webwork:if>
</webwork:if>
<webwork:else>
	<webwork:text name="'common.words.none'"/>
	<webwork:if test="/hasAdminPermission == true">
		(
		<a href="<webwork:url page="SelectProjectScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
		)
	</webwork:if>
</webwork:else>

<%-- Permission Scheme has been added to the project --%>
<br>
<b><webwork:text name="'admin.projects.permission.scheme'"/>:</b>
<webwork:if test="permissionSchemes != null && permissionSchemes/size > 0">
	<webwork:iterator value="permissionSchemes" status="'liststatus'">
		<webwork:property value="string('name')" />
		<webwork:if test="@liststatus/last == false">, </webwork:if>
	</webwork:iterator>
	<webwork:if test="/hasAdminPermission == true">
		(
		<a id="select_permission_scheme" href="<webwork:url page="SelectProjectPermissionScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
		|
		<a id="edit_permission_scheme" href="<webwork:url page="EditPermissions!default.jspa"><webwork:param name="'schemeId'" value="permissionSchemes/(0)/long('id')"/></webwork:url>"><webwork:text name="'common.words.edit'"/></a>
		)
	</webwork:if>
</webwork:if>
<webwork:else>
	<webwork:text name="'common.words.none'"/>
	<webwork:if test="/hasAdminPermission == true">
		(
		<a id="select_permission_scheme" href="<webwork:url page="SelectProjectPermissionScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
		)
	</webwork:if>
</webwork:else>

<%
	if (license !=null && license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL))) { %>
	<%-- Issue Security Scheme has been added to the project --%>
	<br>
	<b><webwork:text name="'admin.projects.issue.security.scheme'"/>:</b>
	<webwork:property value="issueSecuritySchemes" >
		<webwork:if test=". != null && size > 0">
			<webwork:iterator value="." status="'liststatus'">
				<webwork:property value="string('name')" />
				<webwork:if test="@liststatus/last == false">, </webwork:if>
			</webwork:iterator>
			<webwork:if test="/hasAdminPermission == true">
				(
				<a id="select_security_scheme" href="<webwork:url page="SelectProjectIssueSecurityScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /><webwork:param name="'schemeId'" value="./(0)/long('id')"/></webwork:url>"><webwork:text name="'common.words.select'"/></a>
				|

				<a id="edit_security_scheme" href="<webwork:url page="EditIssueSecurities!default.jspa"><webwork:param name="'schemeId'" value="./(0)/long('id')"/></webwork:url>"><webwork:text name="'common.words.edit'"/></a>
				)
			</webwork:if>
		</webwork:if>
		<webwork:else>
			<webwork:text name="'common.words.none'"/>
			<webwork:if test="/hasAdminPermission == true">
				(
				<a id="select_security_scheme" href="<webwork:url page="SelectProjectIssueSecurityScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
				)
			</webwork:if>
		</webwork:else>
	</webwork:property>
    <webwork:if test="/enterprise == true">
        <br>
        <b><webwork:text name="'admin.projects.field.configuration.scheme'"/>:</b>
        <webwork:if test="/fieldLayoutSchemes == null || /fieldLayoutSchemes/empty == true">
            <a id="view_issuefields" href="ViewIssueFields.jspa">System Default Field Configuration</a>
        </webwork:if>
        <webwork:else>
            <webwork:if test="/fieldLayoutScheme == null">
                System Default Field Configuration <webwork:if test="/hasAdminPermission == true">( <a id="select_fieldlayoutscheme" href="<webwork:url page="SelectFieldLayoutScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a> )</webwork:if>
            </webwork:if>
            <webwork:else>
                <webwork:property value="/fieldLayoutScheme/name" />
                <webwork:if test="/hasAdminPermission == true">
                ( <a id="select_fieldlayoutscheme" href="<webwork:url page="SelectFieldLayoutScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
                  | <a id="edit_fieldlayoutscheme" href="<webwork:url page="ConfigureFieldLayoutScheme.jspa"><webwork:param name="'id'" value="/fieldLayoutScheme/id" /></webwork:url>"><webwork:text name="'common.words.edit'"/></a> )
                </webwork:if>
            </webwork:else>
        </webwork:else>
        <!-- Issue Type Screen Scheme -->
        <br>
        <b><webwork:text name="'admin.projects.issue.type.screen.scheme'"/>:</b>
        <webwork:property value="/issueTypeScreenScheme/name" />
        <webwork:if test="/hasAdminPermission == true">
        ( <a id="select_issuetypescreenscheme" href="<webwork:url page="SelectIssueTypeScreenScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
          | <a id="edit_issuetypescreenscheme" href="<webwork:url page="ConfigureIssueTypeScreenScheme.jspa"><webwork:param name="'id'" value="/issueTypeScreenScheme/id" /></webwork:url>"><webwork:text name="'common.words.edit'"/></a> )
        </webwork:if>
    </webwork:if>

    <br>
    <b><webwork:text name="'admin.projects.workflow.scheme'"/>:</b>
    <webwork:property value="/workflowScheme">
        <webwork:if test=". != null">
            <webwork:property value="./string('name')" />
            <webwork:if test="/hasAdminPermission == true">
                (
                <a id="select_workflow_scheme" href="<webwork:url page="SelectProjectWorkflowScheme!default.jspa"><webwork:param name="'projectId'" value="../long('id')" /><webwork:param name="'schemeId'" value="./long('id')"/></webwork:url>"><webwork:text name="'common.words.select'"/></a>
                )
            </webwork:if>
        </webwork:if>
        <webwork:else>
            <webwork:text name="'common.words.none'"/>
            <webwork:if test="/hasAdminPermission == true">
                (
                <a id="select_workflow_scheme" href="<webwork:url page="SelectProjectWorkflowScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
                )
            </webwork:if>
        </webwork:else>
    </webwork:property>

<% } %>

<%-- In professional edition of JIRA it is not possible to associate different scheme screens with isuse types. Screen schemes are associated directly with projects --%>
<% if (license !=null && license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL))) { %>
        <!-- Screen Scheme -->
        <br>
        <b><webwork:text name="'admin.projects.screen.scheme'"/>:</b>
        <webwork:property value="/fieldScreenScheme/name" />
        <webwork:if test="/hasAdminPermission == true">
        ( <a id="select_screenscheme" href="<webwork:url page="SelectScreenScheme!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'common.words.select'"/></a>
          | <a id="edit_screenscheme" href="<webwork:url page="ConfigureFieldScreenScheme.jspa"><webwork:param name="'id'" value="/fieldScreenScheme/id" /></webwork:url>"><webwork:text name="'common.words.edit'"/></a> )
        </webwork:if>
<% } %>


<br>
<% if (license !=null && license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL, JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL))) { %>
    <b><webwork:text name="'admin.projects.cvs.modules'"/>:</b>
<% } else { %>
    <b><webwork:text name="'admin.projects.cvs.module'"/>:</b>
<% } %>
        <%-- see if the project has any repositories --%>
        <webwork:if test="/repositories != null && /repositories/empty == false">
            <webwork:iterator value="/repositories" status="'repostatus'">
                <webwork:property value="./name"/><webwork:if test="@repostatus/last == false">, </webwork:if>
            </webwork:iterator>
        </webwork:if>
        <webwork:else>
            <webwork:text name="'common.words.none'"/>
        </webwork:else>
        <% if (license !=null && (license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL, JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL)))) { %>
            <webwork:if test="/hasAdminPermission == true">
                (
                <a href="<webwork:url page="EnterpriseSelectProjectRepository!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'admin.projects.select.modules'"/></a>
                )
            </webwork:if>
        <% } else { %>
            <webwork:if test="/hasAdminPermission == true">
                (
                <a href="<webwork:url page="SelectProjectRepository!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'admin.projects.select.module'"/></a>
                )
            </webwork:if>
        <% } %>

<%-- Mail Configuration per project - sender email address --%>
<webwork:if test="/hasDefaultSMTPMailServer == true">
<br>
<b><webwork:text name="'admin.projects.mail.configuration'"/>:</b>
    <webwork:property value="projectEmail" >
    <webwork:text name="'admin.projects.mail.notitifications.from'"/>
    <webwork:if test=". == null">
        <webwork:text name="'admin.projects.mail.notifications.from.default'"/>
    </webwork:if>
    <webwork:else>
        '<webwork:property />'
    </webwork:else>

    </webwork:property>
	<webwork:if test="/hasAdminPermission == true">
    (
    <a href="<webwork:url page="ProjectEmail!default.jspa"><webwork:param name="'projectId'" value="long('id')" /></webwork:url>"><webwork:text name="'admin.projects.edit.mail.configuration'"/></a>
    )
    </webwork:if>
</webwork:if>
