cancel
Showing results for 
Search instead for 
Did you mean: 

Joomla/Alfresco document preview problems

kamil_korinek
Champ in-the-making
Champ in-the-making
Hello,

I wanna ask for help. I try all ideas from this posts :
http://forums.alfresco.com/en/viewtopic.php?f=49&t=17668&p=66756&hilit=joomla+alfresco+preview#p5808...
http://forums.alfresco.com/en/viewtopic.php?f=49&t=18426&p=62023#p62023

…but I still couldnt see a document preview. I am using Joomla 1.5. and Alfresco 3.2 community edition with mysql 5.0

I dont know vhich css/js files should use - web-preview or preview and full-preview ??? I try both but without success.
Can anyone provide a functional and workable full code of default_preview_flash.php and the actual preview files (css, js).
I will really appreciate that.

Thanks in advance.
Kamil
IT Department, Czech Firefighters Service
Czech republic, Olomouc
8 REPLIES 8

anya
Champ in-the-making
Champ in-the-making
Alfresco allows see preview of not all documents types  Smiley Tongue
Try any pdf for example - it should work.

anya
Champ in-the-making
Champ in-the-making
the problem described below exists for Alfresco 3.2.

decision:

default_preview_flash:

<?php // no direct acces
defined('_JEXEC') or die('Restricted access');

JHTML::_('behavior.mootools');

$document =& JFactory::getDocument();

//Site-wide YUI Assets
$document->addStylesheet($this->profile->share.'/yui/reset-fonts-grids/reset-fonts-grids.css');
$document->addStylesheet($this->profile->share.'/yui/assets/skins/default/skin.css');
$document->addStylesheet($this->profile->share.'/css/base.css');
$document->addStylesheet($this->profile->share.'/css/yui-layout.css');
$document->addStylesheet($this->profile->share.'/themes/default/presentation.css');


//Common YUI components: RELEASE
$document->addScript($this->profile->share.'/yui/utilities/utilities.js');
$document->addScript($this->profile->share.'/yui/button/button-min.js');
$document->addScript($this->profile->share.'/yui/container/container-min.js');
$document->addScript($this->profile->share.'/yui/menu/menu-min.js');
$document->addScript($this->profile->share.'/yui/json/json-min.js');
$document->addScript($this->profile->share.'/yui/selector/selector-min.js');
$document->addScript($this->profile->share.'/yui/yui-patch.js');


//Site-wide Common Assets
$document->addScript($this->profile->share.'/js/bubbling.v2.1-min.js');
$document->addScript($this->profile->share.'/js/flash/AC_OETags-min.js');
$document->addScript($this->profile->share.'/service/messages.js?locale=ru');

$document->addScript($this->profile->share.'/js/alfresco-min.js');
$document->addScript($this->profile->share.'/js/forms-runtime-min.js');

$document->addScriptDeclaration('
   Alfresco.constants.DEBUG = false;
    Alfresco.constants.PROXY_URI = "'.$this->profile->share.'/proxy/alfresco/";
    Alfresco.constants.THEME = "default";
    Alfresco.constants.URL_CONTEXT = "'.$this->profile->share.'/";
    Alfresco.constants.URL_PAGECONTEXT = "'.$this->profile->share.'/page/";
    Alfresco.constants.URL_SERVICECONTEXT = "'.$this->profile->share.'/service/";
    Alfresco.constants.ALF_TICKET = "'.$this->ticket.'";
    Alfresco.constants.USERNAME = "";

');

// Document Preview
$document->addStylesheet($this->profile->share.'/components/preview/web-preview.css');
$document->addScript($this->profile->share.'/components/preview/web-preview-min.js');

$document->addStylesheet($this->profile->share.'/components/preview/WebPreview.css');
$document->addScript($this->profile->share.'/js/flash/extMouseWheel-min.js');
//$document->addStylesheet($this->profile->share.'/components/preview/full-preview.css');
//$document->addScript($this->profile->share.'/components/preview/full-preview.js');
?>


<div class="yui-g">
         <div class="yui-g first">
<div id="template_x002e_web-preview_x002e_document-details">
<div class="web-preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="template_x002e_web-preview_x002e_document-details-title-img" src="/share/components/images/generic-file-32.png" alt="File" />
            <span id="template_x002e_web-preview_x002e_document-details-title-span"></span>          
         </h4>
      </div>
   </div>
  
   <div class="bd">
     
<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("template_x002e_web-preview_x002e_document-details").setOptions(
{
  nodeRef: "workspace://SpacesStore/e0a08e88-e2e0-4adf-af6c-b0dd55efc045",
   name: "content.Alfresco Share.pdf",
   icon: "/components/images/generic-file-32.png",
   mimeType: "application/pdf",
   previews: ["imgpreview", "avatar", "doclib"]
}).setMessages(
   {"preview.actualSize": "Actual Size", "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>.", "preview.fullscreen": "Fullscreen", "preview.fitHeight": "Fit Height", "error.io": "The preview could not be loaded from the server. ", "preview.fitPage": "Fit Page", "preview.pageOf": "of", "error.content": "The content cannot be displayed because it is not of type png, jpg, gif or swf.", "label.noPreview": "This document can't be previewed.<br\/><a class=\"theme-color-1\" href=\"{0}\">Click here to download it.<\/a>", "preview.page": "Page", "preview.fitWidth": "Fit Width", "preview.fullwindowEscape": "Press Esc to exit full window mode", "preview.fullwindow": "Maximize", "error.error": "The content cannot be displayed due to an unknown error."}
      );
//]]></script>

     <div id="template_x002e_web-preview_x002e_document-details-shadow-swf-div" class="preview-swf">
         <div id="template_x002e_web-preview_x002e_document-details-swfPlayerMessage-div"></div>
      </div>
   </div>
</div></div>

</div></div>  


<div id="alfresco-yuiloader"></div>
   <script type="text/javascript">//<![CDATA[
      Alfresco.util.YUILoaderHelper.loadComponents();
   //]]></script>


Please correct nodeRef and name in this file.

In web-preview-min set
q.addParam("allowScriptAccess","always").

This decision is the result of looking how things work in Alfresco Share, preview in Alfresco Share and Alfresco plugin for Joomla is basicly the same. Smiley Happy

amernet
Champ in-the-making
Champ in-the-making
Hi Anya,

I did what you described in your last post.

In Joomla, I copied your codes and replaced the content of the default_preview_flash.php
I also put back the NodeRef and Name back from original code.

On top of it, I also modified the web-preview-min.js on Alfresco side.

Please advise what-else I overlooked to make the preview work in Joomla.

Thanks!
Charles 

I have Joomla! 1.5.9 Production/Stable & Alfresco 3.2 on mysql5

anya
Champ in-the-making
Champ in-the-making
Hi, Charles!

Do you run Linux or Windows?

Make sure first that Preview Documents in Alfresco Share is working.

Small  addition to default_preview_flash.php -> change
Alfresco.constants.PROXY_URI = "'.$this->profile->share.'/proxy/alfresco/";

to
Alfresco.constants.PROXY_URI = "'.$this->profile->server.'/service/";

kilgad
Champ in-the-making
Champ in-the-making
Hi !

I am testing this integration and he didn't work correctly for me. I copied all your code like charles.

the result :
[img]http://www.monsterup.com/upload/1253102348138.png[/img]


- When i preview my document he ask me for an authentication.
- He need the title, creator and modifier.
- This document (in screen shoot) has four pages, and i can preview only the first.


I will test with old version of alfresco 3.1.

Mycode with all your changement :

    <?php // no direct acces
    defined('_JEXEC') or die('Restricted access');

    JHTML::_('behavior.mootools');

    $document =& JFactory::getDocument();

    //Site-wide YUI Assets
    $document->addStylesheet($this->profile->share.'/yui/reset-fonts-grids/reset-fonts-grids.css');
    $document->addStylesheet($this->profile->share.'/yui/assets/skins/default/skin.css');
   // $document->addStylesheet($this->profile->share.'/css/base.css');
   // $document->addStylesheet($this->profile->share.'/css/yui-layout.css');
   // $document->addStylesheet($this->profile->share.'/themes/default/presentation.css');


    //Common YUI components: RELEASE
    $document->addScript($this->profile->share.'/yui/utilities/utilities.js');
    $document->addScript($this->profile->share.'/yui/button/button-min.js');
    $document->addScript($this->profile->share.'/yui/container/container-min.js');
    $document->addScript($this->profile->share.'/yui/menu/menu-min.js');
    $document->addScript($this->profile->share.'/yui/json/json-min.js');
    $document->addScript($this->profile->share.'/yui/selector/selector-min.js');
    $document->addScript($this->profile->share.'/yui/yui-patch.js');


    //Site-wide Common Assets
    $document->addScript($this->profile->share.'/js/bubbling.v2.1-min.js');
    $document->addScript($this->profile->share.'/js/flash/AC_OETags-min.js');
    $document->addScript($this->profile->share.'/service/messages.js?locale=ru');

    $document->addScript($this->profile->share.'/js/alfresco-min.js');
    $document->addScript($this->profile->share.'/js/forms-runtime-min.js');

    $document->addScriptDeclaration('
       Alfresco.constants.DEBUG = false;
        Alfresco.constants.PROXY_URI = "'.$this->profile->server.'/service/";
        Alfresco.constants.THEME = "default";
        Alfresco.constants.URL_CONTEXT = "'.$this->profile->share.'/";
        Alfresco.constants.URL_PAGECONTEXT = "'.$this->profile->share.'/page/";
        Alfresco.constants.URL_SERVICECONTEXT = "'.$this->profile->share.'/service/";
        Alfresco.constants.ALF_TICKET = "'.$this->ticket.'";
        Alfresco.constants.USERNAME = "admin";

    ');

    // Document Preview
    $document->addStylesheet($this->profile->share.'/components/preview/web-preview.css');
    $document->addScript($this->profile->share.'/components/preview/web-preview-min.js');

    $document->addStylesheet($this->profile->share.'/components/preview/WebPreview.css');
    $document->addScript($this->profile->share.'/js/flash/extMouseWheel-min.js');
    //$document->addStylesheet($this->profile->share.'/components/preview/full-preview.css');
    //$document->addScript($this->profile->share.'/components/preview/full-preview.js');
    ?>


    <div class="yui-g">
             <div class="yui-g first">
    <div id="template_x002e_web-preview_x002e_document-details">
    <div class="web-preview">
       <div class="hd">
          <div class="title">
             <h4>
                <img id="template_x002e_web-preview_x002e_document-details-title-img" src="/share/components/images/generic-file-32.png" alt="File" />
                <span id="template_x002e_web-preview_x002e_document-details-title-span"></span>          
             </h4>
          </div>
       </div>
      
       <div class="bd">
        
    <script type="text/javascript">//<![CDATA[
    new Alfresco.WebPreview("template_x002e_web-preview_x002e_document-details").setOptions(
    {
   nodeRef: 'workspace://SpacesStore/<?php echo $this->file->uuid ?>',
   name: '<?php echo $this->file->name ?>',
       icon: "/components/images/generic-file-32.png",
       mimeType: "application/pdf",
       previews: ["imgpreview", "avatar", "doclib"]
    }).setMessages(
       {"preview.actualSize": "Actual Size", "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>.", "preview.fullscreen": "Fullscreen", "preview.fitHeight": "Fit Height", "error.io": "The preview could not be loaded from the server. ", "preview.fitPage": "Fit Page", "preview.pageOf": "of", "error.content": "The content cannot be displayed because it is not of type png, jpg, gif or swf.", "label.noPreview": "This document can't be previewed.<br\/><a class=\"theme-color-1\" href=\"{0}\">Click here to download it.<\/a>", "preview.page": "Page", "preview.fitWidth": "Fit Width", "preview.fullwindowEscape": "Press Esc to exit full window mode", "preview.fullwindow": "Maximize", "error.error": "The content cannot be displayed due to an unknown error."}
          );
    //]]></script>

         <div id="template_x002e_web-preview_x002e_document-details-shadow-swf-div" class="preview-swf">
             <div id="template_x002e_web-preview_x002e_document-details-swfPlayerMessage-div"></div>
          </div>
       </div>
    </div></div>

    </div></div>  


    <div id="alfresco-yuiloader"></div>
       <script type="text/javascript">//<![CDATA[
          Alfresco.util.YUILoaderHelper.loadComponents();
       //]]>
       </script>

(alfresco on windows xp test)
sry for my bad english

anya
Champ in-the-making
Champ in-the-making
Hi !

- When i preview my document he ask me for an authentication.
- He need the title, creator and modifier.
- This document (in screen shoot) has four pages, and i can preview only the first.

Hi, kilgad!

I know about problem with authentication, but I don't know how to solve it, unfortunetly. :?
The problem of title, creator and modifier should be solved at php side.

kilgad
Champ in-the-making
Champ in-the-making
the demo site work perfectly whith  alfresco 3.1 … i don't understand why they don't publish his code or upgrade the plugin.  Smiley Sad

gomer321
Champ in-the-making
Champ in-the-making
I have installed the Alfresco Labs version 3, I can see the names of the documents from my space Alfresco joomla but I can only see a preview, black box.