<%
/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%>

<%
String tabs1 = ParamUtil.getString(request, "tabs1", "pending");

PortletURL portletURL = renderResponse.createRenderURL();

portletURL.setParameter("tabs1", tabs1);
%>

<liferay-ui:tabs
	names="pending,completed"
	portletURL="<%= portletURL %>"
/>

<%
try {
	String type = "completed";
%>

	<aui:form action="<%= portletURL.toString() %>" method="post" name="fm">
		<c:choose>
			<c:when test='<%= portletName.equals(PortletKeys.MY_WORKFLOW_TASKS) && tabs1.equals("pending") %>'>
				<liferay-ui:search-form
					page="/html/portlet/workflow_tasks/workflow_search_tasks.jsp"
				/>

				<div class="separator" />

				<liferay-ui:panel-container extended="<%= false %>" id="workflowTasksPanelContainer" persistState="<%= true %>">
					<liferay-ui:panel collapsible="<%= true %>" extended="<%= false %>" id="myTasksPanel" persistState="<%= true %>" title='<%= LanguageUtil.get(pageContext, "assigned-to-me") %>'>

						<%
						type = "assigned-to-me";
						%>

						<%@ include file="/html/portlet/workflow_tasks/workflow_tasks.jspf" %>
					</liferay-ui:panel>

					<liferay-ui:panel collapsible="<%= true %>" extended="<%= false %>" id="myRolesTasksPanel" persistState="<%= true %>" title='<%= LanguageUtil.get(pageContext, "assigned-to-my-roles") %>'>

						<%
						type = "assigned-to-my-roles";
						%>

						<%@ include file="/html/portlet/workflow_tasks/workflow_tasks.jspf" %>
					</liferay-ui:panel>
				</liferay-ui:panel-container>
			</c:when>
			<c:otherwise>
				<liferay-ui:search-form
					page="/html/portlet/workflow_tasks/workflow_search_tasks.jsp"
				/>

				<div class="separator" />

				<%@ include file="/html/portlet/workflow_tasks/workflow_tasks.jspf" %>
			</c:otherwise>
		</c:choose>
	</aui:form>

<%
}
catch (Exception e) {
	if (_log.isWarnEnabled()) {
		_log.warn("Error retrieving tasks for user " + user.getUserId(), e);
	}
%>

	<div class="portlet-msg-error">
		<liferay-ui:message key="an-error-occurred-while-retrieving-the-list-of-tasks" />
	</div>

<%
}

PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(pageContext, tabs1), currentURL);
%>

<%!
private static Log _log = LogFactoryUtil.getLog("portal-web.docroot.html.portlet.workflow_tasks.view.jsp");
%>