127bbde00SAndreas Gohr<?php 227bbde00SAndreas Gohr/** 327bbde00SAndreas Gohr * Embed an image gallery 427bbde00SAndreas Gohr * 527bbde00SAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 627bbde00SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 727bbde00SAndreas Gohr */ 827bbde00SAndreas Gohr 927bbde00SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 1027bbde00SAndreas Gohrif(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 1127bbde00SAndreas Gohrrequire_once(DOKU_PLUGIN.'syntax.php'); 1227bbde00SAndreas Gohrrequire_once(DOKU_INC.'inc/search.php'); 1327bbde00SAndreas Gohrrequire_once(DOKU_INC.'inc/JpegMeta.php'); 1427bbde00SAndreas Gohr 1527bbde00SAndreas Gohrclass syntax_plugin_panoview extends DokuWiki_Syntax_Plugin { 1627bbde00SAndreas Gohr /** 1727bbde00SAndreas Gohr * return some info 1827bbde00SAndreas Gohr */ 1927bbde00SAndreas Gohr function getInfo(){ 2027bbde00SAndreas Gohr return confToHash(dirname(__FILE__).'/info.txt'); 2127bbde00SAndreas Gohr } 2227bbde00SAndreas Gohr 2327bbde00SAndreas Gohr /** 2427bbde00SAndreas Gohr * What kind of syntax are we? 2527bbde00SAndreas Gohr */ 2627bbde00SAndreas Gohr function getType(){ 2727bbde00SAndreas Gohr return 'substition'; 2827bbde00SAndreas Gohr } 2927bbde00SAndreas Gohr 3027bbde00SAndreas Gohr /** 3127bbde00SAndreas Gohr * What about paragraphs? 3227bbde00SAndreas Gohr */ 3327bbde00SAndreas Gohr function getPType(){ 3427bbde00SAndreas Gohr return 'block'; 3527bbde00SAndreas Gohr } 3627bbde00SAndreas Gohr 3727bbde00SAndreas Gohr /** 3827bbde00SAndreas Gohr * Where to sort in? 3927bbde00SAndreas Gohr */ 4027bbde00SAndreas Gohr function getSort(){ 4127bbde00SAndreas Gohr return 301; 4227bbde00SAndreas Gohr } 4327bbde00SAndreas Gohr 4427bbde00SAndreas Gohr 4527bbde00SAndreas Gohr /** 4627bbde00SAndreas Gohr * Connect pattern to lexer 4727bbde00SAndreas Gohr */ 4827bbde00SAndreas Gohr function connectTo($mode) { 4927bbde00SAndreas Gohr $this->Lexer->addSpecialPattern('\{\{panoview>[^}]*\}\}',$mode,'plugin_panoview'); 5027bbde00SAndreas Gohr } 5127bbde00SAndreas Gohr 5227bbde00SAndreas Gohr /** 5327bbde00SAndreas Gohr * Handle the match 5427bbde00SAndreas Gohr */ 5527bbde00SAndreas Gohr function handle($match, $state, $pos, &$handler){ 5627bbde00SAndreas Gohr global $ID; 5727bbde00SAndreas Gohr 5827bbde00SAndreas Gohr $options = array( 5927bbde00SAndreas Gohr 'width' => 500, 6027bbde00SAndreas Gohr 'height' => 250, 6127bbde00SAndreas Gohr 'align' => 'center', 6227bbde00SAndreas Gohr 6327bbde00SAndreas Gohr 6427bbde00SAndreas Gohr 'image' => 'zoom:greetsiel.jpg', 6527bbde00SAndreas Gohr 'imageWidth' => 7672, 6627bbde00SAndreas Gohr 'imageHeight' => 1624, 6727bbde00SAndreas Gohr 'initialZoom' => 2, 6827bbde00SAndreas Gohr 6927bbde00SAndreas Gohr 'tileBaseUri' => DOKU_BASE.'lib/plugins/panoview/tiles.php', 7027bbde00SAndreas Gohr 'tileSize' => 256, 7127bbde00SAndreas Gohr 'maxZoom' => 10, 7227bbde00SAndreas Gohr 'blankTile' => DOKU_BASE.'lib/plugins/panoview/gfx/blank.gif', 7327bbde00SAndreas Gohr 'loadingTile' => DOKU_BASE.'lib/plugins/panoview/gfx/progress.gif', 7427bbde00SAndreas Gohr 7527bbde00SAndreas Gohr ); 7627bbde00SAndreas Gohr 7727bbde00SAndreas Gohr 7827bbde00SAndreas Gohr return $options; 7927bbde00SAndreas Gohr } 8027bbde00SAndreas Gohr 8127bbde00SAndreas Gohr /** 8227bbde00SAndreas Gohr * Create output 8327bbde00SAndreas Gohr */ 8427bbde00SAndreas Gohr function render($mode, &$R, $data) { 8527bbde00SAndreas Gohr if($mode != 'xhtml') return false; 8627bbde00SAndreas Gohr 8727bbde00SAndreas Gohr require_once(DOKU_INC.'inc/JSON.php'); 8827bbde00SAndreas Gohr $json = new JSON(); 8927bbde00SAndreas Gohr 90*9d7db126SAndreas Gohr $img = '<a href="'.ml($data['image']).'"><img src="'.ml($data['image'],array('w'=>$data['width'],'h'=>$data['height'])).'" width="'.$data['width'].'" height="'.$data['height'].'" alt="" /></a>'; 9127bbde00SAndreas Gohr 9227bbde00SAndreas Gohr 9327bbde00SAndreas Gohr $R->doc .= ' 9427bbde00SAndreas Gohr<div class="panoview_plugin" style="width: '.$data['width'].'px; height: '.$data['height'].'px;"> 95*9d7db126SAndreas Gohr <div class="well"><!-- --></div> 96*9d7db126SAndreas Gohr <div class="surface">'.$img.'</div> 9727bbde00SAndreas Gohr <p class="controls" style="display: none"> 9827bbde00SAndreas Gohr <span class="zoomIn" title="Zoom In">+</span> 9927bbde00SAndreas Gohr <span class="zoomOut" title="Zoom Out">-</span> 10027bbde00SAndreas Gohr </p> 10127bbde00SAndreas Gohr <div class="options" style="display:none">'.hsc($json->encode($data)).'</div> 10227bbde00SAndreas Gohr</div> 10327bbde00SAndreas Gohr 10427bbde00SAndreas Gohr'; 10527bbde00SAndreas Gohr 10627bbde00SAndreas Gohr 10727bbde00SAndreas Gohr return true; 10827bbde00SAndreas Gohr } 10927bbde00SAndreas Gohr 11027bbde00SAndreas Gohr 11127bbde00SAndreas Gohr} 11227bbde00SAndreas Gohr 11327bbde00SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 : 114