<%@ page import="webwork.util.ValueStack,
                 org.ofbiz.core.entity.GenericValue,
                 webwork.action.CoreActionContext,
                 com.atlassian.core.util.WebRequestUtils"%>
<%@ taglib uri="webwork" prefix="webwork" %>
<%-- 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">
    <webwork:if test="property('projectcategoryid') == 'allCategories'">
        <%-- if we have chosen to show all categories, then we display all projects under their category --%>
        <webwork:iterator value="/projectManager/projectCategories" status="'projectCategories'">
            <webwork:if test="browseableProjectsInCategory(.)/empty == false">
                <webwork:property value="/browseableProjectsInCategory(.)">
                    <%@ include file="/portlets/dashboard/projecttable.jsp" %>
                </webwork:property>
                <p>
            </webwork:if>
        </webwork:iterator>

        <%-- show the projects with no category --%>
        <webwork:property value="browseableProjectsInCategory(null)">
            <%@ include file="/portlets/dashboard/projecttable.jsp" %>
            <p>
        </webwork:property>
    </webwork:if>
    <webwork:else>
        <%-- if we have chosen to show a specific category, then we display only that category --%>
        <webwork:property value="/projectManager/projectCategory(property('projectcategoryid'))">
            <webwork:property value="/browseableProjectsInCategory(.)">
                <%@ include file="/portlets/dashboard/projecttable.jsp" %>
            </webwork:property>
        </webwork:property>
    </webwork:else>
</webwork:if>
<webwork:else>
    <%-- NO category filtering is done - display all projects under one table (Original project table) --%>
    <webwork:property value="/browseableProjects">
        <%@ include file="/portlets/dashboard/projecttable.jsp" %>
    </webwork:property>
</webwork:else>