<%@ page import="webwork.util.ValueStack,
                 org.ofbiz.core.entity.GenericValue,
                 webwork.action.CoreActionContext,
                 com.atlassian.core.util.WebRequestUtils"%>

<%-- to handle backward compatibility, we cannot just test for null.  We need to check for non-empty string --%>
<webwork:if test="enterprise == true && property('projectcategoryid')/length > 0">
    <%-- if we have chosen to show a specific category, then we display only that category --%>
    <webwork:property value="/projectManager/projectCategory(property('projectcategoryid'))">
        <%@ include file="/includes/dashboard/categorisedprojects.jsp" %>
    </webwork:property>
</webwork:if>
<webwork:else>
    <%-- if we have chosen to NOT show a specific category, then we display all categories --%>
    <webwork:if test="browseableProjects/empty == false ">
        <webwork:property value="true" id="showToggle" />
        <%-- show the projects that are in a specific category --%>
        <webwork:iterator value="/projectManager/projectCategories" status="'projectCategories'">
            <webwork:if test="browseableProjectsInCategory(.)/empty == false">
                <%@ include file="/includes/dashboard/categorisedprojects.jsp" %>
                <p>
            </webwork:if>
        </webwork:iterator>

        <%-- show the projects with no category --%>
        <webwork:iterator value="browseableProjectsInCategory(null)">
            <jsp:include page="/includes/dashboard/project.jsp"/>
            <p>
        </webwork:iterator>
        <webwork:property value="false" id="showToggle" />
    </webwork:if>
    <webwork:elseIf test="remoteUser != null">
        <%-- if the user has no browseable projects, then tell them about it --%>
            <table bgcolor="#bbbbbb" border="0" cellpadding="0" cellspacing="0" class="maxWidth">
            <tr><td>
            <table  border="0" cellpadding="3" cellspacing="1" width="100%">
                <%@ include file="/includes/noprojects.jsp" %>
            </table>
            </td></tr>
            </table>
    </webwork:elseIf>
</webwork:else>
