cancel
Showing results for 
Search instead for 
Did you mean: 

File page on CMIS/Joomla plugin not working

ofrxnz
Champ in-the-making
Champ in-the-making
So, I am attempting to use the CMIS plugin for Joomla & Alfresco. 

The plug in mostly works well. 

It connects, populates folders, is navigable, searchable, and even the thumbnails show up.

When I click on a file the preview is supposed to come up with links on the page.

Here is the demo equivalent http://joomla.demo.alfresco.com/joomla/index.php/alfresco/file/1/371a3d6a-3c28-481f-ac15-662ae65561f...

In my case, a blank page pops up.  This page has no source code or scripts or well anything.  it is literally blank as in a null page.  It does not come back with an error though

I noticed some errors in the default_preview_flash.php folder but when i edited them out and basically told it to echo some static string nothing popped up.

My guess the issue is a controller issue or it is jumping to the wrong template. 

Does anyone have any idea what needs to be fixed so the file view works? 

My guess is there was a share update that this plugg in was not updated to handle


Below her are the bugs i found in it already.  These dont seem to be causing my issue. 

In default_preview_flash.php here are some lines that seem to be for an older version of alfresco.


$document->addScript($this->profile->share.'/yui/selector/selector-beta-min.jss');
is miss typed and should be ".js" at the end not ".jss" as seen below
$document->addScript($this->profile->share.'/yui/selector/selector-beta-min.jss');

The following files dont exist.  There is a new script and css in that folder but their is only one not two

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

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

i am running Labs 3 stable/final and Joomla! 1.5.8 Production/Stable

I dont think php is the newest version so i am going to try upgrading
12 REPLIES 12

ofrxnz
Champ in-the-making
Champ in-the-making
it was a php version issue. 

you must have 5.2 or later

The bad includes from share make it so the file will not preview though.  Ill work on patching these next

cbosner
Champ in-the-making
Champ in-the-making
I'm having similar issues.  Everything is working great except the preview.  Looking at the metadata, it's says size 0MB so I'm assuming it can't find the document?

[img]http://i146.photobucket.com/albums/r252/cbosner/misc/alfresco_ss.png[/img]

joomla 1.5
alfresco community 3.1
PHP Version 5.2.4

thanks for any help.

cbosner
Champ in-the-making
Champ in-the-making
Ok, well I've gotten my issue closer to fixed.

in default_preview_flash.php:

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

to

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

<script type="text/javascript">//<![CDATA[
new Alfresco.Preview("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: '<?php echo $this->file->content_type ?>',
   previews: <?php echo json_encode($this->thumbnail->definitions) ?>
}).setMessages(
   {"label.currentFrame": "Page <b>{0}<\/b> of <b>{1}<\/b>", "button.next": "Next", "header.previewDocument": "Preview of {0}", $
      );
//]]></script>

to

<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("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: '<?php echo $this->file->content_type ?>',
   previews: <?php echo json_encode($this->thumbnail->definitions) ?>
}).setMessages(
   {"label.currentFrame": "Page <b>{0}<\/b> of <b>{1}<\/b>", "button.next": "Next", "header.previewDocument": "Preview of {0}", $
      );
//]]></script>

my css is still screwed up but the document is at least loading

ofrxnz
Champ in-the-making
Champ in-the-making
try this man

Its what i have and is looking nice.  the plugin's css sheet needs some changes, but thats more site specific stuff

(im still figuring out which JS scripts are absolutely required….many are commented out.  its stable but throws an error or two)

you should leave the following line as it is in yours….I have modified mine to use individual user accounts with alf_tickets

Alfresco.constants.USERNAME = "";


here is the default_preview_flash.php file

<?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');

//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-beta-min.js');

//Site-wide Common Assets
//$document->addScript($this->profile->share.'/js/bubbling.v1.5.0.js');
$document->addScript($this->profile->share.'/js/flash/AC_OETags.js');
//$document->addScript($this->profile->share.'/service/messages.js?locale=en_US');
$document->addScript($this->profile->share.'/js/alfresco.js');
//$document->addScript($this->profile->share.'/js/forms-runtime.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.js');

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

<div id="document-details">
<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("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: "<?php echo $this->file->content_type ?>",
   previews: <?php echo json_encode($this->thumbnail->definitions) ?>
}).setMessages(
   {"label.currentFrame": "Page <b>{0}<\/b> of <b>{1}<\/b>", "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.jumpToPage": "Jump to page:", "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\/>Click <a href=\"{0}\">here<\/a> to download it.", "button.fullPreview": "Full Screen", "error.io": "The preview could not be loaded form the server. "}
      );
//]]></script>

<div class="web-preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="document-details-title-img" src=""/>
            <span id="document-details-title-span"></span>
         </h4>
      </div>
   </div>
   <div class="bd">
      <div id="document-details-swfPlayer-div" class="preview-swf">
         <div id="document-details-swfPlayerMessage-div"></div>
      </div>
   </div>
</div>
</div>



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

ofrxnz
Champ in-the-making
Champ in-the-making
on that last post, that version of the code threw some JS errors.  in this version, i figured out exactly which scripts are needed.   if you take my last post the following lines need to change as follows, there should be no JS errors

//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');

//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-beta-min.js');

//Site-wide Common Assets
//$document->addScript($this->profile->share.'/js/bubbling.v1.5.0.js');
$document->addScript($this->profile->share.'/js/flash/AC_OETags.js');
$document->addScript($this->profile->share.'/service/messages.js?locale=en_US');
$document->addScript($this->profile->share.'/js/alfresco.js');
//$document->addScript($this->profile->share.'/js/forms-runtime.js');


full code

<?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');

//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-beta-min.js');

//Site-wide Common Assets
//$document->addScript($this->profile->share.'/js/bubbling.v1.5.0.js');
$document->addScript($this->profile->share.'/js/flash/AC_OETags.js');
$document->addScript($this->profile->share.'/service/messages.js?locale=en_US');
$document->addScript($this->profile->share.'/js/alfresco.js');
//$document->addScript($this->profile->share.'/js/forms-runtime.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.js');

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

<div id="document-details">
<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("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: "<?php echo $this->file->content_type ?>",
   previews: <?php echo json_encode($this->thumbnail->definitions) ?>
}).setMessages(
   {"label.currentFrame": "Page <b>{0}<\/b> of <b>{1}<\/b>", "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.jumpToPage": "Jump to page:", "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\/>Click <a href=\"{0}\">here<\/a> to download it.", "button.fullPreview": "Full Screen", "error.io": "The preview could not be loaded form the server. "}
      );
//]]></script>

<div class="web-preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="document-details-title-img" src=""/>
            <span id="document-details-title-span"></span>
         </h4>
      </div>
   </div>
   <div class="bd">
      <div id="document-details-swfPlayer-div" class="preview-swf">
         <div id="document-details-swfPlayerMessage-div"></div>
      </div>
   </div>
</div>
</div>



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

hanzo
Champ in-the-making
Champ in-the-making
It works for me as follow. you need only to change the  ".jss" at the end for ".js"   :wink:

<?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');

//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-beta-min.js');

//Site-wide Common Assets
$document->addScript($this->profile->share.'/js/bubbling.v1.5.0.js');
$document->addScript($this->profile->share.'/js/flash/AC_OETags.js');
$document->addScript($this->profile->share.'/service/messages.js?locale=en_US');
$document->addScript($this->profile->share.'/js/alfresco.js');
$document->addScript($this->profile->share.'/js/forms-runtime.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 = "'.$this->profile->username.'";
');

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

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

<div id="document-details">
<script type="text/javascript">//<![CDATA[
new Alfresco.Preview("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: '<?php echo $this->file->content_type ?>',
   previews: <?php echo json_encode($this->thumbnail->definitions) ?>
}).setMessages(
   {"label.currentFrame": "Page <b>{0}<\/b> of <b>{1}<\/b>", "button.next": "Next", "header.previewDocument": "Preview of {0}", "error.contentNotAVM2MovieClip": "The preview cannot be displayed since its not a AVM2 movie clip", "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.jumpToPage": "Jump to page:", "label.noPreview": "This document can't be previewed.<br\/>Click <a href=\"{0}\">here<\/a> to download it.", "button.fullPreview": "Full Screen", "message.invalidFrame": "You must enter a frame between {0} and {1}", "error.server": "The preview cannot be displayed due to a server error", "button.previous": "Prev"}
      );
//]]></script>
<div class="preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="document-details-title-img" src=""/>
            <span id="document-details-title-span"></span>
         </h4>

      </div>
      <div id="document-details-fullscreen-div" class="fullscreen" style="visibility: hidden;">
         <input id="document-details-fullPreview-button" type="button" value="Full Screen" />
      </div>
   </div>
   <div id="document-details-controls-div" class="controls" style="visibility: hidden;">
      <input id="document-details-previous-button" type="button" value="Prev" />
      <span  id="document-details-currentFrame-span">Page <b>{0}</b> of <b>{1}</b></span>

      <input id="document-details-next-button" type="button" value="Next" />
      <span>  |  </span>
      <span>Jump to page:</span>
      <input id="document-details-jumpToPage-textfield" class="jumpToPage" type="text" />
   </div>
   <div class="bd">
      <div id="document-details-swfPlayer-div" class="preview-swf">
         <div id="document-details-swfPlayerMessage-div"></div>

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

open the demo equivalent http://joomla.demo.alfresco.com/joomla/index.php/alfresco/file/1/371a3d6a-3c28-481f-ac15-662ae65561f... with your browser
if you open the temporary internet files in IE you can see all the component files and also the missing files  :lol:

full-preview.js
full-preview.css
preview.js
preview.css

just copy this files in your alfresco

C:\Alfresco\tomcat\webapps\share\components\preview

and enjoy this powerfull integration  Smiley Tongue

ofrxnz
Champ in-the-making
Champ in-the-making
Yeah, I saw that too, but it appeared they stopped using the following files in the most recent version of Share

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

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

these files are still floating around but appear to be being phased out. 


seems like they are now using the web-preview files…

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

Don't know whether one version of the preview is newer or better or what, but the last code i posted works great with the web-preview files.

Anyone know if one version is better or if one is being phased out?

mikeh
Star Contributor
Star Contributor
Ignore the preview.* and full-preview.* files - these should be removed if they're still lingering.

Thanks,
Mike

anya
Champ in-the-making
Champ in-the-making
open the demo equivalent http://joomla.demo.alfresco.com/joomla/index.php/alfresco/file/1/371a3d6a-3c28-481f-ac15-662ae65561f... with your browser
if you open the temporary internet files in IE you can see all the component files and also the missing files  :lol:

full-preview.js
full-preview.css
preview.js
preview.css

just copy this files in your alfresco

C:\Alfresco\tomcat\webapps\share\components\preview

and enjoy this powerfull integration  Smiley Tongue

This trick doesn't work for Alfresco 3.1. I suppose the version of these preview files is too old.