Slideshow2 Handler

See also:
works with:
  • Wikka 1.1.6.2 & 1.1.6.3 & 1.1.6.4
NOT included in any Wikka version
Last edited by DomBonj:
Replaces old-style internal links with new pipe-split links.
Fri, 20 May 2016 07:38 UTC [diff]

This is the development page for the Slideshow2 handler.

Installation


Code


1. New handlers/page/slideshow.php file

handlers/page/slideshow.php


<?php                                        
#
# Displays the page as a slideshow
#
# @package      Handlers
# @name         slideshow
#
# @authors      DomBonj

# @version      0.91
#
# @uses         Wakka::Footer()
# @uses         Wakka::Format()
# @uses         Wakka::HasAccess()
# @uses         Wakka::Header()
# @uses         Wakka::ReturnSafeHTML()
# @uses         ERROR_ACL_READ
#

// i18n strings
if(!defined('ERROR_ACL_READ')) define('ERROR_ACL_READ', 'You aren\'t allowed to read this page.');

if (!$this->HasAccess('read'))
{
    print($this->Header(). '<div class="page"><p><em class="error">'. ERROR_ACL_READ .'</em></p></div>'. $this->Footer());
}
else
{
    if ($this->page)
    {
        header("Content-type: text/html");
        $theme_dir = '/3rdparty/plugins/S5/ui/default';
        // render page
        $the_page = $this->Format($this->page['body'], 'wakka');
        if (preg_match('/^.*?<h1>(.*?)<\/h1>/i', $the_page, $matches))
        // process title slide and gather meta-data
        {
            $slideshow_title = $matches[1];
            if (preg_match("/<h5>_author_(.*?)<\/h5>/i", $the_page, $matches2))
            {
                $presenter_name = (isset($matches2[1]) ? trim($matches2[1]) : '');
                $the_page = preg_replace("/<h5>_author_.*?<\/h5>/i", "", $the_page);
            }
            if (preg_match("/<h5>_affiliation_(.*?)<\/h5>/is", $the_page, $matches2))
            {
                $presenter_affiliation = (isset($matches2[1]) ? trim($matches2[1]) : '');
                $the_page = preg_replace("/<h5>_affiliation_.*?<\/h5>/is", "", $the_page);
            }
            if (preg_match("/<h5>_footer1_(.*?)<\/h5>/s", $the_page, $matches2))
            {
                $footer1 = (isset($matches2[1]) ? trim($matches2[1]) : '');
                $the_page = preg_replace("/<h5>_footer1_.*?<\/h5>/s", "", $the_page);
            }
            if (preg_match("/<h5>_footer2_(.*?)<\/h5>/s", $the_page, $matches2))
            {
                $footer2 = (isset($matches2[1]) ? trim($matches2[1]) : '');
                $the_page = preg_replace("/<h5>_footer2_.*?<\/h5>/s", "", $the_page);
            }
            $the_page = preg_replace('/^.*?<h1>(.*?)<\/h1>/', '', $the_page);
        }
        $the_page = preg_replace("/.*?<h1>(.*?)<\/h1>/", "</div>\n<div class=\"slide\"><h1>$1</h1>", $the_page);
        $the_page = preg_replace("/<h5>\_handout_(.*?)<\/h5>/is", "<div class=\"handout\">$1</div>", $the_page);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title><?php echo htmlentities($slideshow_title, ENT_QUOTES); ?></title>
<!-- metadata -->
<meta name="generator" content="S5" />
<meta name="version" content="S5 1.1" />
<meta name="author" content="<?php echo htmlentities($presenter_name, ENT_QUOTES); ?>" />
<meta name="company" content="<?php echo htmlentities($presenter_affiliation, ENT_QUOTES); ?>" />
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<meta name="controlVis" content="hidden" />
<!-- style sheet links -->
<?php echo '<link rel="stylesheet" href="'.$theme_dir.'/slides.css" type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="'
.$theme_dir.'/outline.css" type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="'
.$theme_dir.'/print.css" type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="'
.$theme_dir.'/opera.css" type="text/css" media="projection" id="operaFix" />
<!-- S5 JS -->
<script src="'
.$theme_dir.'/slides.js" type="text/javascript"></script>'."\n"; ?>
</head>
<body>

<div class="layout">
    <div id="controls"><!-- DO NOT EDIT --></div>
    <div id="currentSlide"><!-- DO NOT EDIT --></div>
    <div id="header"></div>
    <div id="footer">
        <h1><?php echo $this->ReturnSafeHTML($footer1); ?></h1>
        <h2><?php echo $this->ReturnSafeHTML($footer2); ?></h2>
    </div>
</div>

<div class="presentation">
<div class="slide">
<?php
        echo '<h1>'. $this->ReturnSafeHTML($slideshow_title) .'</h1><h3>'. $this->ReturnSafeHTML($presenter_name) .'</h3><h4>'. $this->ReturnSafeHTML($presenter_affiliation) .'</h4>';
       
        echo $the_page;
    } // if ($this->page)
}
?>

</div>
</div>

2. In 3rdparty/plugins/S5/ui/default/slides.js, go to line 384 and replace the following code block:

	controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
	'<div id="navLinks">' +
	'<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' +
	'<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' +
	'<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' +

with the following code block:

	var newURL = location.href.replace(/\/slideshow$/, '/edit');
	controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
	'<div id="navLinks">' +
	'<a accesskey="t" title="toggle views" id="toggle" href="javascript:toggle();">Ø<\/a>' +
	'<a accesskey="z" title="previous" id="prev" href="javascript:go(-1);">«<\/a>' +
	'<a accesskey="x" title="next" id="next" href="javascript:go(1);">»<\/a>' +
	'<a accesskey="e" title="edit" id="edit" href="'+ newURL +'">±<\/a>' +

3. In libs/Wakka.class.php, go to line 1037 [versions 1.1.6.2 & 1.1.6.3 only] or to line 1743 [version 1.1.6.4 only] and replace the following code block:

        // grabcode page handler
        elseif ($this->method == "grabcode")
        {
            print($this->Method($this->method));
        }
        elseif (preg_match('/\.(gif|jpg|png)$/', $this->method))

with the following code block:

        // grabcode page handler
        elseif ($this->method == "grabcode")
        {
            print($this->Method($this->method));
        }
        // slideshow page handler
        elseif ($this->method == "slideshow")
        {
            print($this->Method($this->method));
        }
        elseif (preg_match('/\.(gif|jpg|png)$/', $this->method))

4. New 3rdparty/plugins/S5/.htaccess file

3rdparty/plugins/S5/.htaccess


<IfModule mod_rewrite.c>
RewriteEngine off
</IfModule>                         
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki