<%
/**
 * 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.
 */
%>

<c:if test="<%= CalendarPermission.contains(permissionChecker, scopeGroupId, ActionKeys.EXPORT_ALL_EVENTS) %>">
	<aui:fieldset label="export">
		<aui:input cssClass="lfr-input-text-container" label="" name="exportFileName" type="text" value="liferay.ics" />
	</aui:fieldset>

	<portlet:actionURL var="exportEventsURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
		<portlet:param name="struts_action" value="/calendar/export_events" />
	</portlet:actionURL>

	<%
	String taglibOnClick = "document." + renderResponse.getNamespace() + "fm.action = '" + exportEventsURL + "'; document." + renderResponse.getNamespace() + "fm.submit();";
	%>

	<aui:button-row>
		<aui:button onClick="<%= taglibOnClick %>" value="export" />
	</aui:button-row>
</c:if>

<c:if test="<%= CalendarPermission.contains(permissionChecker, scopeGroupId, ActionKeys.ADD_EVENT) %>">
	<c:if test="<%= CalendarPermission.contains(permissionChecker, scopeGroupId, ActionKeys.EXPORT_ALL_EVENTS) %>">
		<br /><br />
	</c:if>

	<aui:fieldset label="import">
		<aui:input cssClass="lfr-input-text-container" label="" name="file" type="file" />
	</aui:fieldset>

	<portlet:actionURL var="importEventsURL">
		<portlet:param name="struts_action" value="/calendar/import_events" />
		<portlet:param name="redirect" value="<%= currentURL %>" />
	</portlet:actionURL>

	<%
	String taglibOnClick = "document." + renderResponse.getNamespace() + "fm.encoding = 'multipart/form-data'; document." + renderResponse.getNamespace() + "fm.action = '" + importEventsURL + "'; document." + renderResponse.getNamespace() + "fm.submit();";
	%>

	<aui:button-row>
		<aui:button onClick="<%= taglibOnClick %>" value="import" />
	</aui:button-row>
</c:if>