<%--
/**
 * Copyright (c) 2000-present 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.
 */
--%>

<portlet:actionURL name="installApp" var="installAppURL" />

<aui:form action="<%= installAppURL %>" cssClass="install-apps" enctype="multipart/form-data" method="post" name="fm1">
	<aui:input name="redirect" type="hidden" value="<%= portletURL.toString() %>" />

	<c:if test="<%= CompanyLocalServiceUtil.getCompaniesCount(false) > 1 %>">
		<div class="alert alert-info">
			<liferay-ui:message key="installed-apps-are-available-to-all-portal-instances.-go-to-plugins-configuration-within-each-portal-instance-to-enable-disable-each-app" />
		</div>
	</c:if>

	<aui:fieldset label="install">
		<liferay-ui:success key="pluginUploaded" message="the-plugin-was-uploaded-successfully-and-is-now-being-installed" />

		<liferay-ui:success key="pluginDownloaded" message="the-plugin-was-downloaded-successfully-and-is-now-being-installed" />

		<div class="install-method local">
			<liferay-ui:error exception="<%= UploadException.class %>" message="an-unexpected-error-occurred-while-uploading-your-file" />

			<aui:input label="file-upload-lpkg-or-war-file" name="installMethod" type="radio" value="local" />

			<aui:input cssClass="file-input" label="" name="file" type="file" />
		</div>

		<div class="install-method remote">
			<liferay-ui:error key="invalidUrl" message="please-enter-a-valid-url" />

			<aui:input label="url" name="installMethod" type="radio" value="remote" />

			<aui:input cssClass="file-input" label="" name="url" type="text" />
		</div>

		<aui:button type="submit" value="install" />
	</aui:fieldset>
</aui:form>

<aui:script use="aui-base">
	A.one('.marketplace-portlet .install-method.local .file-input').on(
		'change',
		function(event) {
			A.one('.marketplace-portlet .install-method.local input[type=radio]').attr('checked', true);
		}
	);

	A.one('.marketplace-portlet .install-method.remote .file-input').on(
		'click',
		function(event) {
			A.one('.marketplace-portlet .install-method.remote input[type=radio]').attr('checked', true);
		}
	);
</aui:script>