<%@ taglib uri="webwork" prefix="webwork" %>
<%@ taglib uri="webwork" prefix="ui" %>
<%@ taglib uri="sitemesh-page" prefix="page" %>

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

<html>
<head>
	<title><webwork:text name="'portal.configure'"/></title>
</head>
<body>
<table cellpadding=0 cellspacing=0 border=0 width=100%>
<tr>
<td width=200 bgcolor="f0f0f0" valign=top>
    <webwork:property value="remoteUser">
    <jsp:include page="/includes/panels/user_summary_pane.jsp" />
    </webwork:property>
</td>

<td bgcolor=ffffff valign=top>
<table width=100% cellpadding=10 cellspacing=0 border=0><tr><td>

<page:applyDecorator name="jirapanel">
    <page:param name="title"><webwork:text name="'portal.configure'"/></page:param>
    <page:param name="width">100%</page:param>
    <page:param name="helpURL">configure_portal_pages</page:param>

    <p>
        <webwork:text name="'configureportalpages.description.line1'"/><br>
        <webwork:text name="'configureportalpages.description.line2'">
            <webwork:param name="'value0'"><span class="warning"></webwork:param>
            <webwork:param name="'value1'"></span></webwork:param>
        </webwork:text>
    </p>
    <p>
        <img src="<webwork:url page="/images/icons/bullet_creme.gif"/>" height="8" width="8" border="0">&nbsp;<a href="<webwork:url page="RestoreDefaultDashboard!default.jspa"><webwork:param name="'destination'" value="'manageportal'"/></webwork:url>"><webwork:text name="'restoredefaultdashboard.restoredefaults'"/></a>
    </p>
</page:applyDecorator>


<webwork:if test="/currentPortalPage/default == false">
        <p>
        <table align=center bgcolor="bbbbbb" border="0" cellpadding="0" cellspacing="0" width=90%><tr><td>
        <table border="0" cellpadding="3" cellspacing="1" width=100%>
            <tr bgcolor=f0f0f0>
                <td class="colHeaderLink">
                    <b><webwork:text name="'common.words.name'" /></b>
                </td>
                <td>
                    &nbsp;
                </td>
                <td class="colHeaderLink">
                    <b><webwork:text name="'common.words.operations'" /></b>
                </td>
            </tr>

            <webwork:iterator value="/dashboardPages" status="'status'">
            <tr bgcolor="#<webwork:if test="@status/modulus(2) == 1">ffffff</webwork:if><webwork:else>fffff0</webwork:else>">
                 <td valign=top>
                    <b><a href="<%= request.getContextPath() %>/secure/Dashboard.jspa?selectPageId=<webwork:property value="./id"/>"><webwork:property value="/pageName(.)" /></a></b>
                    <webwork:if test="/currentPortalPage == .">
                        <span class="smallgrey"><webwork:text name="'configureportalpages.currentpage'"/></span>
                    </webwork:if>

                    <webwork:if test="description && description/length > 0">
                        <br>
                        <webwork:property value="description"/>
                    </webwork:if>
                </td>

                <td width=1% nowrap>
                    <webwork:if test="@status/first == false">
                    <a href="ConfigurePortalPages!moveToStart.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/first.gif"  class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.first'"/>"></a>
                    <a href="ConfigurePortalPages!moveUp.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/up.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.up'"/>"></a></webwork:if>
                    <webwork:else><image src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow"><image src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow"></webwork:else>
                    <webwork:if test="@status/last != true">
                    <a href="ConfigurePortalPages!moveDown.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/down.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.down'"/>"></a>
                    <a href="ConfigurePortalPages!moveToEnd.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/last.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.last'"/>"></a></webwork:if>
                    <webwork:else><image src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow"><image src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow"></webwork:else>
                </td>

                <td valign=top nowrap>
                    <a href="DashboardConfig!default.jspa?selectPageId=<webwork:property value="./id"/>"><webwork:text name="'configureportalpages.fullconfigure'"/></a>

                    <webwork:if test="pageName != 'dashboard'">
                     | <a href="EditPortalPage!default.jspa?pageId=<webwork:property value="./id"/>"><webwork:text name="'common.words.edit'"/></a> | <a href="ConfigurePortalPages!delete.jspa?pageId=<webwork:property value="./id"/>"><webwork:text name="'common.words.delete'"/></a>
                    </webwork:if>
                </td>
            </tr>
            </webwork:iterator>
        </table>
        </td></tr></table>
        </p>
<%
    License license = LicenseManager.getInstance().getLicense(JiraLicenseUtils.JIRA_LICENSE_KEY);
    if (license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL, JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL)))
    {
%>
            <p>
            <page:applyDecorator name="jiraform">
                <page:param name="action">ConfigurePortalPages.jspa</page:param>
                <page:param name="submitName"><webwork:text name="'common.forms.add'"/></page:param>
                <page:param name="title"><webwork:text name="'configureportalpages.addpage'"/></page:param>
                <page:param name="width">90%</page:param>
                <ui:textfield label="/text('common.words.name')" name="'addPageName'" size="'30'">
                    <ui:param name="'mandatory'">true</ui:param>
                </ui:textfield>

                <ui:textfield label="/text('common.words.description')" name="'description'" size="'60'" />

                <ui:select label="/text('configureportalpages.startfrom')" name="'copyPageId'" list="dashboardPages" listKey="'id'" listValue="'/pageName(.)'">
                    <ui:param name="'headerrow'"><webwork:text name="'configureportalpages.blankpage'" /></ui:param>
                    <ui:param name="'description'"><webwork:text name="'configureportalpages.blankpage.description'" /></ui:param>
                </ui:select>
            </page:applyDecorator>
            </p>
<%
    }
%>
</webwork:if>

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