<%-- Copyright 1997-2008 Day Management AG Barfuesserplatz 6, 4001 Basel, Switzerland All Rights Reserved. This software is the confidential and proprietary information of Day Management AG, ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with Day. --%><%@page session="false" import="java.net.URLEncoder, java.util.Date, java.util.Locale, java.util.ResourceBundle, com.day.cq.dam.api.Asset, com.day.cq.i18n.I18n, com.day.cq.wcm.api.WCMMode, com.day.cq.wcm.api.components.DropTarget, org.apache.commons.lang.StringUtils, com.day.cq.dam.scene7.api.constants.Scene7Constants" %> <%@include file="/libs/foundation/global.jsp"%> <%@include file="/libs/dam/components/scene7/utils/s7PageCloudConfig.jsp" %> <% if((WCMMode.fromRequest(request) == WCMMode.EDIT) || (WCMMode.fromRequest(request) == WCMMode.DESIGN) ) { %><% } %> <% Locale pageLocale = currentPage.getLanguage(true); ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLocale); I18n i18n = new I18n(resourceBundle); long timestamp = new Date().getTime(); String width = properties.get("width",currentStyle.get("defaultWidth", "-1")); String height = properties.get("height",currentStyle.get("defaultHeight", "-1")); String fileReference = properties.get("fileReference",String.class); boolean s7content = (fileReference != null && fileReference.indexOf("/is/image") != -1); if (s7content) { int idx = fileReference.indexOf("?"); if (idx != -1) { fileReference = fileReference.substring(0,idx); } } Asset asset = null; Resource fileRefRes = resourceResolver.getResource(fileReference); if (fileRefRes != null) { asset = (!s7content ? fileRefRes.adaptTo(Asset.class) : null); } if ((fileReference == null) || (!s7content && (fileRefRes == null || asset == null))) { %>
">
<% } else { long origWidth = 500; long origHeight = 500; if(asset != null) { origWidth = (asset.getMetadataValueFromJcr("tiff:ImageWidth") != null ? (long) Double.parseDouble(asset.getMetadataValueFromJcr("tiff:ImageWidth")) : origWidth); origHeight = (asset.getMetadataValueFromJcr("tiff:ImageLength") != null ? (long) Double.parseDouble(asset.getMetadataValueFromJcr("tiff:ImageLength")) : origHeight); } int widthInt = Integer.parseInt(width); int heightInt = Integer.parseInt(height); if(widthInt < 0 && heightInt < 0) { width = "500"; height = "500"; }else if(widthInt < 0) { width = Long.toString(heightInt * origWidth / origHeight); }else if(heightInt < 0) { height = Long.toString(widthInt * origHeight / origWidth); } String id = ""; String publishStatus = ""; if (asset != null) { id = asset.getMetadataValueFromJcr(Scene7Constants.PN_S7_ASSET_ID); publishStatus = asset.getMetadataValueFromJcr(Scene7Constants.PN_S7_FILE_STATUS) != null? asset.getMetadataValueFromJcr(Scene7Constants.PN_S7_FILE_STATUS):Scene7Constants.PV_S7_PUBLISH_COMPLETE; } // if the asset is not yet set _or_ the upload/publish has not yet completed if (!s7content && ("".equals(id) || !Scene7Constants.PV_S7_PUBLISH_COMPLETE.equals(publishStatus))) { //asset not uploaded if((WCMMode.fromRequest(request) == WCMMode.EDIT) || (WCMMode.fromRequest(request) == WCMMode.DESIGN) ) { String uploadText = i18n.get("Publish to Scene7", "Scene7 upload link text"); if(!Scene7Constants.PV_S7_PUBLISH_COMPLETE.equals(publishStatus)) uploadText = i18n.get("Check Scene7 Publish Status", "Check Publish Status link text"); %> <% } else { %> <% } } else { // parameters to viewer String cursorFadeTime = currentStyle.get("cursorFadeTime", String.class); String flyoutHideDelay = currentStyle.get("flyoutHideDelay", String.class); String flyoutHideTime = currentStyle.get("flyoutHideTime", String.class); String flyoutShowDelay = currentStyle.get("flyoutShowDelay", String.class); String flyoutShowTime = currentStyle.get("flyoutShowTime", String.class); String frictionCoef = currentStyle.get("frictionCoef", String.class); String imageFadeTime = currentStyle.get("imageFadeTime", String.class); String messageDisplayTime = currentStyle.get("messageDisplayTime", String.class); String messageFadeTime = currentStyle.get("messageFadeTime", String.class); String messageTextDesktop = currentStyle.get("messageTextDesktop", String.class); String messageTextTouch = currentStyle.get("messageTextTouch", String.class); String modifier = currentStyle.get("modifier", String.class); String scrollTime = currentStyle.get("scrollTime", String.class); String useFixedCursor = currentStyle.get("useFixedCursor", String.class); String zoomFactor = currentStyle.get("zoomFactor", String.class); String domain = ""; String ref = ""; if (s7content) { int idx = fileReference.indexOf("is/image/"); domain = fileReference.substring(0,idx); ref = fileReference.substring(idx+9); } else { domain = asset.getMetadataValueFromJcr(Scene7Constants.PN_S7_DOMAIN); ref = asset.getMetadataValueFromJcr(Scene7Constants.PN_S7_FILE); } // CSS to viewer String flyoutBorder = currentStyle.get("flyoutBorder", String.class); if (flyoutBorder == null) { flyoutBorder = "1px solid"; } String flyoutBorderColor = currentStyle.get("flyoutBorderColor", String.class); if (flyoutBorderColor == null) { flyoutBorderColor = "C2C2C2"; } String flyoutFrame = currentStyle.get("flyoutFrame", String.class); if (flyoutFrame == null) { flyoutFrame = "1px solid"; } String flyoutFrameColor = currentStyle.get("flyoutFrameColor", String.class); if (flyoutFrameColor == null) { flyoutFrameColor = "A9A9A9"; } String flyoutColor = currentStyle.get("flyoutColor", String.class); if (flyoutColor == null) { flyoutColor = "FFFFFF"; } String flyoutOpacity = currentStyle.get("flyoutOpacity", String.class); if (flyoutOpacity == null) { flyoutOpacity = "70"; } String flyoutOpacityFloat = String.valueOf(Integer.parseInt(flyoutOpacity)/100.0); String flyoutSize = currentStyle.get("flyoutSize", String.class); String flyoutWidth = (flyoutSize != null ? flyoutSize.split(",")[0] : "50"); String flyoutHeight = (flyoutSize != null ? flyoutSize.split(",")[1] : "50"); String flyoutPosition = currentStyle.get("flyoutPosition", String.class); String flyoutOffsetX = (flyoutPosition != null ? flyoutPosition.split(",")[0] : "0"); String flyoutOffsetY = (flyoutPosition != null ? flyoutPosition.split(",")[1] : "0"); %>
<% }// end else embed } %>