<%
import org.exoplatform.clouddrive.CloudDrive
import org.exoplatform.clouddrive.CloudFile
import org.exoplatform.wcm.webui.reader.ContentReader

// should be set in CloudFileFilter
def drive = uicomponent.drive
def file = uicomponent.file
if (drive && file) {
  def title = ContentReader.getXSSCompatibilityContent(file.title)
  def serviceName = drive.user.serviceName
  def openOn = _ctx.appRes("CloudFileViewer.event.OpenOn")
%>
<div id="CloudFileViewer" file-open-on="${openOn} ${serviceName}" style="position: relative; height: 100%; overflow: hidden;">
  <div style="text-align:center; display: none;" class="file-content">
    <embed width="610" allowscriptaccess="always" wmode="opaque" quality="high" bgcolor="#ffffff" 
				name="$title" id="$title" src="$file.previewLink" type="application/x-shockwave-flash"/>
  </div>
<%
} else {%>
	<p>Cannot load cloud file viewer. Refresh the page.</p>
<%
}
%>
</div>
