Author Topic: file info - freemind viewer plugin  (Read 13839 times)

max

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
file info - freemind viewer plugin
« on: April 10, 2009, 09:43:47 pm »
hi,
I'm continuing this thread here because it went off-topic.

I'm trying to integrate a viewer for freemind-files into file_details_content.php.

it's a flash app that loads a .mm file, then renders it interactively.

but it only works if
EITHER i run the code outside of file_details_content.php - i.e. in its own static HTML file -
OR i run the code inside file_details_content.php, but with a fixed, static MM file.

heres the code which works in a static HTML file, but not within file_details_content.php:

<?php if (substr($file->getFileName(),-3)==".mm") {?>

<script type="text/javascript" src="http://my.server.com/maxns/flashobject.js"></script>
   <div id="flashcontent" >
       Flash plugin or Javascript are turned off.
       Activate both  and reload to view the mindmap
   </div>
   
   <script type="text/javascript">
      // <![CDATA[
      // for allowing using http://.....?mindmap.mm mode
      function getMap(map){
        var result=map;
        var loc=document.location+'';
        if(loc.indexOf(".mm")>0 && loc.indexOf("?")>0){
         result=loc.substring(loc.indexOf("?")+1);
        }
        return result;
      }
      var fo = new FlashObject("http://my.server.com/maxns/visorFreemind.swf", "visorFreeMind", "100%", "100%", 6, "#9999ff");
      fo.addParam("quality", "high");
      fo.addParam("bgcolor", "#a0a0f0");
      fo.addVariable("openUrl", "_blank");
      fo.addVariable("startCollapsedToLevel","3");
      fo.addVariable("maxNodeWidth","200");
      
      fo.addVariable("mainNodeShape","elipse");
      fo.addVariable("justMap","false");
      fo.addVariable("initLoadFile","http://my.server.com/index.php?c=files&a=download_file&id=17");
      fo.addVariable("defaultToolTipWordWrap",200);
      fo.addVariable("offsetX","left");
      fo.addVariable("offsetY","top");
      fo.addVariable("buttonsPos","top");
      fo.addVariable("min_alpha_buttons",20);
      fo.addVariable("max_alpha_buttons",100);
      fo.addVariable("scaleTooltips","false");
      fo.write("flashcontent");
      // ]]>
   </script>
<?php }?>


The way it fails is: the flash applet starts, but apparently can't load the mm file, rendering "undefined" only.

what am i missing?

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: file info - freemind viewer plugin
« Reply #1 on: April 13, 2009, 01:53:51 pm »
It is really strange that it works on a static HTML but not on OpenGoo and that it works on OpenGoo when using a static file. Can you send me a test .mm file and the .swf file so that I can test it too? And send me the flashobject.js file too, please.

Thanks.

max

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: file info - freemind viewer plugin
« Reply #2 on: April 13, 2009, 06:55:24 pm »
The SWF, an example HTML, JS and sample MM files are here.

There's also a note on that page on a similar problem when renaming files from .mm to .xml would workarounf the problem, as it might have to do with MIME types not registered on the server. I don't know enough about that, but it fells that's about the right direction...

I'd be curious if it works for you!

best
max

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: file info - freemind viewer plugin
« Reply #3 on: April 14, 2009, 02:35:05 pm »
Hi max,

I managed to make it work. I added this code to file_content_details.php:
Code: [Select]
<?php if (substr($file->getFilename(), -3) == '.mm') {
$flashurl get_public_url('assets/flash/visorFreemind.swf'?>

<div id="<?php echo $genid ?>mm">
<script type="text/javascript">
var fo = new FlashObject("<?php echo $flashurl ?>", "visorFreeMind", "100%", "350px", 6, "#9999ff");
fo.addParam("quality", "high");
fo.addParam("bgcolor", "#ffffff");
fo.addVariable("initLoadFile", "<?php echo $file->getDownloadUrl() ?>");
fo.addVariable("openUrl", "_blank");
fo.write("<?php echo $genid ?>mm");
</script>
<?php ?>

Then I placed 'visorFreemnid.swf' on 'public/assets/flash', I placed 'flashboject.js' on 'public/assets/javascript' and added 'flashobject.js' to the list of files that is loaded on startup on 'application/layout/javascripts.php'

Pretty cool!  8)

max

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: file info - freemind viewer plugin
« Reply #4 on: April 14, 2009, 08:21:00 pm »
Ignacio, you Gooroo!
It works! Cool indeed! Makes me enthusiastic about making add-ons. And perhaps one day I might learn how to really do it.

In the meantime one could think of what other viewers to integrate…

scribd has a flash-based viewer for many office formats, but is totally closed source and i believe they even own the servers. However it displays:
    *  Adobe PDF (.pdf)
    * Adobe PostScript (.ps)
    * Microsoft Word (.doc, .docx)
    * Microsoft PowerPoint (.ppt, .pps, .pptx)
    * Microsoft Excel (.xls, xlsx)
    * OpenOffice Text Document (.odt, .sxw)
    * OpenOffice Presentation Document (.odp, .sxi)
    * OpenOffice Spreadsheet (.ods, .sxc)
    * All OpenDocument formats
    * Plain text (.txt)
    * Rich text format (.rtf)

ThinkFree Unipaper does the same, software-as-a-service-style.

Both are unusable in the context of openGoo because of their digital rights restrictions. But I take them as proof of concept that it can be done nicely.

Then of course it's possible to integrate the Adobe Acrobat reader into a webpage.

Ajax Document Viewer supports the above plus ca. 50 deprecated digital fax file formats…

…and what about web based viewers for CAD files any most other things done with extra plugins…

and certainly there will be more…!

(I'll make a note on my internal wishlist)

kitkatneko

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: file info - freemind viewer plugin
« Reply #5 on: June 10, 2009, 03:59:47 pm »
this is a great topic. my questions now are:
-is this to become a module in opengoo?
-would opengoo update process kill the mod if made?

Thanks!

max

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: file info - freemind viewer plugin
« Reply #6 on: August 02, 2009, 06:25:21 am »
kitkatneko,

This has been added alrady as a permanent part of opengoo.
just opload a .mm file andc there you are.

kitkatneko

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: file info - freemind viewer plugin
« Reply #7 on: August 04, 2009, 02:38:25 pm »
I did not even try! thank you for the info, it works well!
Thanks!

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: file info - freemind viewer plugin
« Reply #8 on: August 11, 2009, 11:34:48 am »
WOW, somehow I missed this thread.  I used to use Freemind a few years ago, but recently switched to the web-based MindMeister (they have a free account for up to 3 mms).  It allows me to export to .mm format, and it's awesome to be able to view my mindmap in OG!
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?

max

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: file info - freemind viewer plugin
« Reply #9 on: August 11, 2009, 01:04:48 pm »
Pet,
I've just tried out XMind and felt like it's going quite a bit further than Freemind, with about the same degree of open-Sourceness to it. Never mind their commerial model, though. They do want to create a Mash-up-API which hopefully would allow us to integrate it into OpenGoo as well.

Have you compared MindMeister and XMind yet? I'd be curious.


Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: file info - freemind viewer plugin
« Reply #10 on: August 14, 2009, 06:31:01 am »
I have compared them. Unfortunately XMind's free version does not allow me to privately share my mindmap which is the dealbreaker, since the information I'm collecting is not public. In the free version, your XMind mindmaps become available publicly by default and you have to pay to make them private. They are both pretty good otherwise, nicer features than Freemind.

MindMeister gives me the ability to privately share my mindmaps with my colleagues in the free version. So for me the only choice is MindMeister.
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?