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

<%
PortletURL printAssetURL = renderResponse.createRenderURL();

printAssetURL.setWindowState(LiferayWindowState.POP_UP);

printAssetURL.setParameter("struts_action", "/asset_publisher/view_content");
printAssetURL.setParameter("assetEntryId", String.valueOf(assetEntry.getEntryId()));
printAssetURL.setParameter("viewMode", Constants.PRINT);
%>

<c:choose>
	<c:when test="<%= print %>">
		<liferay-ui:icon
			image="print"
			label="<%= true %>"
			message='<%= LanguageUtil.format(pageContext, "print-x-x", new Object[] {"aui-helper-hidden-accessible", assetRenderer.getTitle()}) %>'
			url="javascript:print();"
		/>

		<aui:script>
			print();
		</aui:script>
	</c:when>
	<c:otherwise>
		<liferay-ui:icon
			image="print"
			label="<%= true %>"
			message='<%= LanguageUtil.format(pageContext, "print-x-x", new Object[] {"aui-helper-hidden-accessible", assetRenderer.getTitle()}) %>'
			url='<%= "javascript:" + renderResponse.getNamespace() + "printPage_" + assetEntryIndex + "();" %>'
		/>

		<aui:script>
			function <portlet:namespace />printPage_<%= assetEntryIndex %>() {
				window.open('<%= printAssetURL %>', '', "directories=0,height=480,left=80,location=1,menubar=1,resizable=1,scrollbars=yes,status=0,toolbar=0,top=180,width=640");
			}
		</aui:script>
	</c:otherwise>
</c:choose>