cancel
Showing results for 
Search instead for 
Did you mean: 

call document preview

dabada83
Champ in-the-making
Champ in-the-making
Can I call and show this web script on web client

    org/alfresco/modules/document-preview.get -> http://joomla.demo.alfresco.com/share/service/script/org/alfresco/modules/document-preview.get

This script is used (on share) to show a document preview (using transformations and a swfplayer).

The question is how to add preview capabilities on web client?
9 REPLIES 9

mikeh
Star Contributor
Star Contributor
The easiest entry point would probably be to customise the [img]http://forums.alfresco.com/en/images/icons/smile/info.gif[/img] icon. Make the pop-up panel larger and include the preview either inline via an include directive, or in an iframe (which might be easier due to the JavaScript dependencies and possible conflicts with existing js code in the Explorer client).

Mike

dabada83
Champ in-the-making
Champ in-the-making
Thanks for reply.

But how I can use this web script (document-preview) because I not found this script on
       http://127.0.0.1:8080/alfresco/service/index

this script is on:
       http://127.0.0.1:8080/share/service/index

Can I use this script on Explorer client? or only on share?

When I try to call I have an error, I believe that this script needs a param

/**
    * Preview constructor.
    *
    * @param {string} htmlId The HTML id of the parent element
    * @return {Alfresco.Preview} The new Preview instance
    * @constructor
    * @private
    */
I think that this parent element is document-details page on share, when I try to call from web client (http://127.0.0.1:8080/share/service/components/preview/preview?nodeRef=workspace://SpacesStore/0d6dd...) I have an error because I don't have parent ID "Expression args.htmlid is undefined on line 2, column 25 in org/alfresco/components/preview/preview.get.html.ftl."

Maybe can I use a template + javascript + swfplayer?
http://www.techbits.de/2007/03/02/integrating-freemind-documents-into-alfresco/

with regards - diego

mikeh
Star Contributor
Star Contributor
Yes it's part of Share, so you'll likely need an iframe along with some other client-side dependencies. It might not even work because it's been designed to run as part of a Surf page, not standalong, hence the missing htmlid parameter. The latter is easily solved by appending ?htmlid=abc (or anything you like - it's an DOM ID prefix) to the webscript call.

The preview will likely want the nodeRef of the document too, so you'll also have to pass that in.

Mike

dabada83
Champ in-the-making
Champ in-the-making
How can I use document-preview script from a Surf-based page? I want to create a standalone page using Surf, and put a link to this page from the web-client …
I need to now if I need to copy share scripts on my new site or can reuse…
I'm not sure if I need to use share/modules/document-preview
  <webscript>
    <shortname>Document Preview</shortname>
    <description>Displays a flash preview of document.</description>
    <url>/modules/document-preview</url>
  </webscript>

or
share/components/preview…
  <webscript>
    <shortname>Preview</shortname>
    <description>Displays a flash preview of a document.</description>
    <url>/components/preview/preview</url>
  </webscript>

Need some examples on how to do this, I have seen the webinar introduction to Surf but I need a more complete examples…

with regards - diego

mikef
Champ in-the-making
Champ in-the-making
You can try calling the Flash preview swf directly passing in the relevant args, this avoids the having to setup the other contextual information that the Share webscript expects.
The raw markup is below, you'd obviously need to pass in the nodeRef.

<div>
<embed type="application/x-shockwave-flash" src="/share/components/preview/WebPreviewer.swf"
  style="" id="WebPreviewer"
  name="WebPreviewer"
  quality="high"
  allowscriptaccess="sameDomain"
  allowfullscreen="true"
  wmode="transparent"
  flashvars="fileName=category test&amp;paging=true&amp;url=http://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/f54d9c51-5c9e-4dc0-ab2e-d2... Size&amp;i18n_fitPage=Fit Page&amp;i18n_fitWidth=Fit Width&amp;i18n_fitHeight=Fit Height&amp;i18n_fullscreen=Fullscreen&amp;i18n_page=Page&amp;i18n_pageOf=of" width="100%" height="670">
</div>

dwilson
Champ in-the-making
Champ in-the-making
You can try calling the Flash preview swf directly passing in the relevant args, this avoids the having to setup the other contextual information that the Share webscript expects.
The raw markup is below, you'd obviously need to pass in the nodeRef.

<div>
<embed type="application/x-shockwave-flash" src="/share/components/preview/WebPreviewer.swf"
  style="" id="WebPreviewer"
  name="WebPreviewer"
  quality="high"
  allowscriptaccess="sameDomain"
  allowfullscreen="true"
  wmode="transparent"
  flashvars="fileName=category test&amp;paging=true&amp;url=http://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/f54d9c51-5c9e-4dc0-ab2e-d2... Size&amp;i18n_fitPage=Fit Page&amp;i18n_fitWidth=Fit Width&amp;i18n_fitHeight=Fit Height&amp;i18n_fullscreen=Fullscreen&amp;i18n_page=Page&amp;i18n_pageOf=of" width="100%" height="670">
</div>
Has this been tried with Alfresco Community 3.2 and the new Flash preview?   Has anyone successfully worked the flash preview to occur standalone in a separate site outside of Share?

Thanks,
Dave

dwilson
Champ in-the-making
Champ in-the-making
*bump*

Still interested…

mikeh
Star Contributor
Star Contributor

dwilson
Champ in-the-making
Champ in-the-making
Yes!  Thanks Mike, will try asap.