Web Script: org/alfresco/components/preview/web-preview.get
Generated from /share/service/script/org/alfresco/components/preview/web-preview.get on Jun 14, 2026 2:44:58 PM

Script Properties
Id:org/alfresco/components/preview/web-preview.get
Short Name:Web Preview
Description:Displays a zoom, move and pageable preview of a content as long as its a .swf, .jpg, .png or .gif
Authentication:none
Transaction:none
Method:GET
URL Template:/components/preview/web-preview
Format Style:any
Default Format:html
Negotiated Formats:[undefined]
Implementation:class org.alfresco.web.scripts.DeclarativeWebScript
Extensions:[undefined]

Store: classpath:alfresco/site-webscripts

File: org/alfresco/components/preview/web-preview.get.desc.xml
<webscript>
  <shortname>Web Preview</shortname>
  <description>Displays a zoom, move and pageable preview of a content as long as its a .swf, .jpg, .png or .gif</description>
  <url>/components/preview/web-preview</url>
</webscript>
File: org/alfresco/components/preview/web-preview.get.head.ftl
<!-- Web Preview -->
<link rel="stylesheet" type="text/css" href="${page.url.context}/components/preview/web-preview.css" />
<script type="text/javascript" src="${page.url.context}/components/preview/web-preview.js"></script>
<script type="text/javascript" src="${page.url.context}/js/flash/extMouseWheel.js"></script>
File: org/alfresco/components/preview/web-preview.get.html.ftl
<#if (node?exists)>
<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("${args.htmlid}").setOptions(
{
   nodeRef: "${node.nodeRef}",
   name: "${node.name?html}",
   icon: "${node.icon}",
   mimeType: "${node.mimeType}",
   previews: [<#list node.previews as p>"${p}"<#if (p_has_next)>, </#if></#list>]
}).setMessages(
   ${messages}
      );
//]]></script>
</#if>
<div class="web-preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="${args.htmlid}-title-img" src=""/>
            <span id="${args.htmlid}-title-span"></span>
         </h4>
      </div>
   </div>
   <div class="bd">
      <div id="${args.htmlid}-swfPlayer-div" class="preview-swf">
         <div id="${args.htmlid}-swfPlayerMessage-div"></div>
      </div>
   </div>
</div>
File: org/alfresco/components/preview/web-preview.get.js
// Check mandatory parameters
var nodeRef = args.nodeRef; //page.url.args.nodeRef;
if (nodeRef == null || nodeRef.length == 0)
{
   status.code = 400;
   status.message = "Parameter 'nodeRef' is missing.";
   status.redirect = true;
}


// Call repo for node's metadata
var json = remote.call("/api/metadata?nodeRef=" + nodeRef);
if (json.toString().trim().length() != 0)
{
   var node = {};
   var n = eval('(' + json + ')');
   var mcns = "{http://www.alfresco.org/model/content/1.0}";

   // Call repo for available previews
   json = remote.call("/api/node/" + nodeRef.replace(":/", "") + "/content/thumbnaildefinitions");
   var previews =  eval('(' + json + ')');

   node.nodeRef = nodeRef;
   node.name = n.properties[mcns + "name"];
   node.icon = "/components/images/generic-file-32.png";
   node.mimeType = n.mimetype;
   node.previews = previews;

   // Prepare the model
   model.node = node;
}

File: org/alfresco/components/preview/web-preview.get.properties
header.previewDocument=Preview of {0}

label.noFlash=To view the preview please download the latest Flash Player from the<br/> \
  <a href="http://www.adobe.com/go/getflashplayer">Adobe Flash Player Download Center</a>.
label.noPreview=This document can't be previewed.<br/>\
   Click <a href="{0}">here</a> to download it.
button.fullPreview=Full Screen
label.currentFrame=Page <b>{0}</b> of <b>{1}</b>
label.jumpToPage=Jump to page:

error.content=The content cannot be displayed because it is not of type png, jpg, gif or swf.
error.io=The preview could not be loaded form the server. 

Store: classpath:alfresco/webscripts

[No implementation files]