<?php
/**
 *  Panorama-Picture Plugin
 *
 *  @license    GPL 2 ( http://www.gnu.org/licenses/gpl.html )
 *  @author     jaloma.ac [at] googlemail [dot] com
 *
 *  Description:
 *  Helper-Modul to Render Panorama-Applet/Flashplayer
 *
 */



class render_helper
{
    function _render_java($data)
    {
        global $conf;
        $width = $data['width'];
        $height = $data['height'];
        $name = $data['name'];
        $archive = "panostudioviewer.jar";
        $code = "panoStudioViewer.PanoStudioViewer.class";
        $archive = DOKU_BASE.'lib/exe/fetch.php?media='.$archive;
        $bname = $name;
        $name = DOKU_BASE.$conf['savedir'].'/media/'.str_replace(":", "/", $name);
        $txt = "";
        $txt .= '<applet code="'.$code.'"'.
        ' width="'.$width.'"'.
        ' height="'.$height.'"'.
        ' archive="'.$archive.'"'.
        ' name="'.$bname.'">'.
        '<param name="pano" value="'.$name.'.xml"/>'.
        '</applet>';
        return $txt;
    }
    function _render_swf($data)
    {
        global $conf;
        $archive = "panostudioviewer.swf";
        //$archive = DOKU_BASE.'lib/exe/fetch.php?media='.$archive;
        $archive = DOKU_BASE.$conf['savedir'].'/media/'.$archive;
        $width = $data['width'];
        $height = $data['height'];
        $name = $data['name'];
        $bname = $name;
        $name = DOKU_BASE.$conf['savedir'].'/media/'.str_replace(":", "/", $name);
        $flashVars = 'pano='.$name.'.xml';
        $txt = "";
        $withObject = true;
        if ($withObject)
        {
            $txt .= '<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000"';
            $txt .= ' width="'.$width.'"';
            $txt .= ' height="'.$height.'"';
            $txt .= ' id="'.$bname.'"';
            $txt .= ' codebase="http://active.macromedia.com/flash9/cabs/swflash.cab#version=9,0,28,0">';
            $txt .= ' <param name="movie" value="'.$archive.'" />';
            $txt .= ' <param name="allowScriptAccess" value="always" />';
            $txt .= ' <param name="allowNetworking" value="all" />';
            $txt .= ' <param name="allowFullScreen" value="'.$allowFullScreen.'" />';
            $txt .= ' <param name="FlashVars" value="'.$flashVars.'" />';
        }
        $txt .= '<embed src="'.$archive.'" ';
        $txt .= ' type="application/x-shockwave-flash" ';
        $txt .= ' width="'.$width.'" ';
        $txt .= ' height="'.$height.'" ';
        $txt .= ' allowFullScreen="'.$allowFullScreen.'" ';
        $txt .= ' bgcolor="'.$bgColor.'"';
        $txt .= ' allowScriptAccess="always"';
        $txt .= ' allowNetworking="all"';
        $txt .= ' allowFullScreen="true"';
        $txt .= ' name="'.$bname.'"';
//        $txt .= ' seamlesstabbing="false"';
        $txt .= ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"';
        $txt .= ' flashVars="'.$flashVars.'"';
        $txt .= '>';
        $txt .= '</embed>';
        if ($withObject)
        {
            $txt .= '</object>';
        }
        return $txt;
    }
	/*<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="600" height="400" id="pano"
codebase="http://active.macromedia.com/flash9/cabs/swflash.cab#version=9,0,28,0">
<param name="movie" value="panoStudioViewer.swf" />
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="pano=panorama_1.xml" />
<embed src="panoStudioViewer.swf" width="600" height="400"
type="application/x-shockwave-flash" name="pano"
allowScriptAccess="always" allowNetworking="all" allowFullScreen="true"
FlashVars="pano=panorama_1.xml"
pluginspage="http://www.macromedia.com/go/getflashplayer" >
</embed>
</object>
*/
}
