diff --git a/SlideShowPlugin/data/System/SlideShowPlugin.txt b/SlideShowPlugin/data/System/SlideShowPlugin.txt new file mode 100644 index 0000000000..b8f01e39cb --- /dev/null +++ b/SlideShowPlugin/data/System/SlideShowPlugin.txt @@ -0,0 +1,175 @@ +%META:TOPICINFO{author="ProjectContributor" date="1217665619" format="1.1" version="$Rev: 15746 $"}% +---+!! Slide Show Plugin + +Converts a topic with headings into a slideshow. + +%TOC% + +---++ Introduction + +There is already a defacto standard for presentations, why this plugin? This plugin makes sense for organizations that do already have lots of content in Foswiki: It is easy to create a web based presentation that contains many links to related content. The plugin does not try to compete with the bells and whistles of the other presentation program, but the markup of Foswiki and other plugins like Foswiki:Extensions/ChartPlugin, Foswiki:Extensions/GaugePlugin, Foswiki:Extensions/SpreadSheetPlugin, Foswiki:Extensions/FoswikiDrawPlugin can be used to create appealing presentations. + +Any topic with headings can be converted into a slideshow. Each slide starts with a ="---++"= heading. There are two modes to view a topic: + + * Normal topic view mode: Headings and text is shown in the usual Foswiki rendering, representing the outline of the slideshow. This mode is useful to print handouts. + * Presentation mode: Each heading with text is shown as a slide; the format is based on a slide template. Navigation buttons are added to go to the "First", "Previous", and "Next" slide. Slide navigation is quick because it is done with anchor jumps to the same page. + +You can start the presentation by clicking on the "Start presentation" button. + +---++ Syntax rules + +---+++ How to create a slideshow + + * Start with =%SLIDESHOWSTART%= + * Use the optional =template= parameter to specify your own slide template topic, e.g. =%SLIDESHOWSTART{ template="MyOwnSlideTemplate" }%= + * Create the slides. Start each slide with a ="---++"= heading and add text like paragraphs, bullets, tables and images. + * *Hint:* Make sure to keep each slide short enough so that you do not need to scroll to see all text of a slide during the presentation. + * *Note:* You can use any heading level you like, but use the same for all slides. + * End your slideshow with =%SLIDESHOWEND%= + +---+++ How to create your own slide template + +To create your own template topic, copy the "Default Slide Template" section below into your own slide template topic and customize it to your needs. It can be activated as the default template in the plugin's =TEMPLATE= setting, or per slideshow with the =%SLIDESHOWSTART{ template="MyOwnSlideTemplate" }%= setting. + + * Use a DIV or an HTML table that defines a slide. For example, create one row for the slide title, another one for the slide text. + * These keywords can be used: + | *Keyword* | *What it means* | + | =%SLIDETITLE%= | The heading of the slide | + | =%SLIDETEXT%= | The text of the slide | + | =%SLIDECOMMENT%= | The comment of the slide (optional; appended to slide of missing) | + | =%SLIDENUM%= | The current slide number | + | =%SLIDEMAX%= | The last slide number | + * And for navigation buttons: + | =%SLIDENAV%= | The navigation buttons for "First", "Previous", "Next" slide | + | =%SLIDENAVALL%= | The navigation buttons for "First", "Previous", "Next", "Last" slide | + | =%SLIDENAVFIRST%= | The navigation button for "First slide" | + | =%SLIDENAVPREV%= | The navigation button for "Previous slide" | + | =%SLIDENAVNEXT%= | The navigation button for "Next slide" | + | =%SLIDENAVLAST%= | The navigation button for "Last slide" | + * Only text between =%STARTINCLUDE%= and =%STOPINCLUDE%= is used for the template. + +---++ Example + +This is a short example of a slideshow. You should see a "Start presentation" button if this plugin is installed: + +%SLIDESHOWSTART% +---++ Introduction +This is slide one. + +%TOC% + +---++ Hamlet meets his father's ghost + * Hamlet learns that his father was killed by his brother Claudius and Queen Gertrude. + * Claudius has quickly become king. +---++ This is rather upsetting + * The ghost demands revenge. + * Hamlet agrees. + * His friends swear to keep what they have seen a secret. +---++ Meanwhile... + * the King's advisor Polonius meets his daughter Ophelia. Hamlet has upset her. + * Hamlet is acting mad +---+++ Comments + * This text is not shown in the slide if HIDECOMMENTS is set to on. +---++ Please tune this template +Tune the look of this template by using CSS ( slideshow.css attached to this document) +%SLIDESHOWEND% + +This text is not part of the slideshow + +---++ %TOPIC% preferences + +Plugin settings are stored as [[%SYSTEMWEB%.PreferenceSettings][preference settings]]. To reference a plugin setting write ==%<plugin>_<setting>%==, i.e. ==%SLIDESHOWPLUGIN_SHORTDESCRIPTION%== + + * One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic: + * Set SHORTDESCRIPTION = Create web based presentations based on topics with headings. + + * Debug plugin: (See output in =data/debug.txt=) + * Set DEBUG = 0 + + * Default template for slides: + * Set TEMPLATE = SlideShowPlugin + + * Label for Comments section + * Set COMMENTS_LABEL = Comments + + * Hide text starting with a =---+++ %COMMENTS_LABEL%= heading: + * Set HIDECOMMENTS = + +---++ Default slide template + +You can create a new topic(MyWeb.SlidesTemplate) somewhere and adding =STARTINCLUDE your template STOPINCLUDE= to it. Afterwards, you can add =%SLIDESHOWSTART{template="MyWeb.SlidesTemplate"}%= to show you presentations with this new template. +%BR% +---+++ Customizing the Look of you presentation +Just customize the attached slideshow.css file to improve the view + +---+++ Current default template +The part between the rulers defines the default format of a slide: + +%STARTINCLUDE%
+
+Page %SLIDENUM% of %SLIDEMAX% +
+
+%SLIDENAVALL% +

%SLIDETITLE%

+
+
+%SLIDETEXT% +
+
+%SLIDECOMMENT% +
+
%STOPINCLUDE% +
+ +---++ Plugin installation instructions + +*Note:* You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where Foswiki is running. + + * Download the ZIP file from the Plugin Home (see below) + * Unzip ==%TOPIC%.zip== in your Foswiki installation directory. Content: + | *File:* | *Description:* | + | ==data/System/%TOPIC%.txt== | Plugin topic | + | ==lib/Foswiki/Plugins/%TOPIC%.pm== | Plugin Perl module | + | ==lib/Foswiki/Plugins/%TOPIC%/SlideShow.pm== | Plugin Perl module | + | ==pub/System/*.gif== | Various button image files | + * Run the [[%SCRIPTURL{"configure"}][configure]] script, and enable the plugin in the {Plugins} section. + * Test above example if the installation was successful. + +---++ Plugin info +| Author: | Foswiki:Main.EugenMayer, Foswiki:Main.ArthurClemens | +| Copyright: | Copyright (C) 2006-2007 Peter Thoeny, peter@thoeny.org and TWiki Contributors; 2008-2009 Foswiki Contributors | +| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | +| Plugin Version: | 18 Feb 2009 | +| Change History: |   | +| 18 Feb 2009: | Fixed =HIDECOMMENTS= to really hide the comment if value is =on= - otherwise the comment is shown in the comments section; added customizable =COMMENTS_LABEL= for all non-English speaking people. Updated default template and css; cleaned up code: now uses a =cover= instead of a =skin= so the style of the installed skin is used (unless redefined in the css file); use a custom template; when in slideshow mode, hide topic text; removed extraneously generated spaces; improved error messages; from the button "End presentation" link back to the start button. | +| 05 Feb 2009: | Updated graphics; made html and css validate. | +| 21 Jan 2009: | Exchanged the current default skin by something which is not written in totaly broken html and looking acceptable ( still needs an update, still table ugly design..). You can style by CSS now %BR% Tuned the docs a bit| +| 16 Dec 2008: | Foswiki version | +| 02 Aug 2008: | Fixed corruption of preview | +| 29 Sep 2007: | Added %SYSTEMWEB%.VarSLIDESHOWSTART and %SYSTEMWEB%.VarSLIDESHOWEND to have them listed in [[%SYSTEMWEB%.Macros]] | +| 12 Feb 2007: | fixed construction of view urls (TWiki:Main/MichaelDaum) | +| 19 Nov 2006: | 12011: Preserve URL parameters in slideshow (suggested by TWiki:Main/ThomasWeigert); changed logo in default template to T-logo; fixed warning errors introduced by 1.005 | +| 16 Mar 2005: | 1.005 Crawford Currie prepped for Dakar, and fixed multiple evaluation bug | +| 21 Nov 2004: | 1.004 Added support for =%SLIDECOMMENT%= template keyword (TWiki:Main/ArthurClemens); added benchmarks | +| 21 Mar 2004: | Internal change: Fixed unofficial function call | +| 14 Dec 2002: | Added =%SLIDENAVALL%= template keyword; added HIDECOMMENTS setting | +| 23 Nov 2002: | Added =%SLIDENAVLAST%= template keyword; using print Skin for presentation mode | +| 19 Nov 2002: | Added "Start presentation" and "End presentation" buttons; added =%SLIDENAVFIRST%=, =%SLIDENAVPREV%=, =%SLIDENAVNEXT%= template keywords | +| 17 Nov 2002: | Initial version | +| CPAN Dependencies: | none | +| Other Dependencies: | none | +| Perl Version: | 5.008 | +| Plugin Home: | http://foswiki.org/Extensions/%TOPIC% | +| Support: | http://foswiki.org/Support/%TOPIC% | + +--- +*Related Topics:* %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences, [[%SYSTEMWEB%.Plugins][Plugins]] + +%META:FILEATTACHMENT{name="next.gif" attr="h" comment="Next button" date="1037510613" path="next.gif" size="993" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="prev.gif" attr="h" comment="Prev button" date="1037510599" path="prev.gif" size="993" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="startpres.gif" attr="h" comment="Start Presentation button" date="1037759933" path="startpres.gif" size="2065" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="endpres.gif" attr="h" comment="End Presentation button" date="1037759950" path="endpres.gif" size="2066" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="first.gif" attr="h" comment="First slide button" date="1037951064" path="first.gif" size="1010" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="last.gif" attr="h" comment="Last slide button" date="1037951080" path="last.gif" size="1014" user="ProjectContributor" version="1.1"}% +%META:FILEATTACHMENT{name="slideshow.css" attachment="slideshow.css" attr="" comment="" date="1232310261" path="slideshow.css" size="4" version="1"}% diff --git a/SlideShowPlugin/data/System/VarSLIDESHOWEND.txt b/SlideShowPlugin/data/System/VarSLIDESHOWEND.txt new file mode 100644 index 0000000000..9b37d3e21d --- /dev/null +++ b/SlideShowPlugin/data/System/VarSLIDESHOWEND.txt @@ -0,0 +1,8 @@ +%META:TOPICINFO{author="ProjectContributor" date="1191133909" format="1.1" version="$Rev$"}% +%META:TOPICPARENT{name="Macros"}% +#VarSLIDESHOWEND +---+++ SLIDESHOWEND -- end slideshow + * The =%SLIDESHOWEND%= macro is handled by the SlideShowPlugin + * Syntax: =%SLIDESHOWEND%= + * Example: See SLIDESHOWSTART + * Related: [[#VarSLIDESHOWSTART][SLIDESHOWSTART]], SlideShowPlugin diff --git a/SlideShowPlugin/data/System/VarSLIDESHOWSTART.txt b/SlideShowPlugin/data/System/VarSLIDESHOWSTART.txt new file mode 100644 index 0000000000..f8a137a5ea --- /dev/null +++ b/SlideShowPlugin/data/System/VarSLIDESHOWSTART.txt @@ -0,0 +1,17 @@ +%META:TOPICINFO{author="ProjectContributor" date="1191133809" format="1.1" version="$Rev$"}% +%META:TOPICPARENT{name="Macros"}% +#VarSLIDESHOWSTART +---+++ SLIDESHOWSTART -- convert a topic with headings into a slideshow + * The =%SLIDESHOWSTART%= macro is handled by the SlideShowPlugin + * Syntax: =%SLIDESHOWSTART%= + * Syntax: =%SLIDESHOWSTART{ template="MyOwnSlideTemplate" }%= + * Example:%BR% + =%SLIDESHOWSTART%= %BR% + =---++ Sample Slide 1= %BR% + =  * Bullet 1= %BR% + =  * Bullet 2= %BR% + =---++ Sample Slide 2= %BR% + =  * Bullet 1= %BR% + =  * Bullet 2= %BR% + =%SLIDESHOWEND%= + * Related: [[#VarSLIDESHOWEND][SLIDESHOWEND]], SlideShowPlugin diff --git a/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin.pm b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin.pm new file mode 100644 index 0000000000..38193c6e80 --- /dev/null +++ b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin.pm @@ -0,0 +1,78 @@ +# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ +# +# Copyright (C) 2002-2007 Peter Thoeny, peter@thoeny.org +# Copyright (C) 2008-2009 Eugen Mayer, Arthur Clemens, Foswiki Contributors +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. For +# more details read LICENSE in the root of this distribution. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details, published at +# http://www.gnu.org/copyleft/gpl.html +# +# As per the GPL, removal of this notice is prohibited. +# Authors: Eugen Mayer, http://foswiki.org/Main/EugenMayer + + +package Foswiki::Plugins::SlideShowPlugin; + +use vars qw( + $web $topic $user $installWeb $VERSION $RELEASE $debug $addedHead + ); + +$addedHead = 0; + +# This should always be $Rev$ so that Foswiki can determine the checked-in +# status of the plugin. It is used by the build automation tools, so +# you should leave it alone. +$VERSION = '$Rev$'; + +# This is a free-form string you can use to "name" your own plugin version. +# It is *not* used by the build automation tools, but is reported as part +# of the version number in PLUGINDESCRIPTIONS. +$RELEASE = '18 Feb 2009'; + + +sub initPlugin +{ + ( $topic, $web, $user, $installWeb ) = @_; + + # check for Plugins.pm versions + if( $Foswiki::Plugins::VERSION < 1 ) { + Foswiki::Func::writeWarning( "Version mismatch between SlideShowPlugin and Plugins.pm" ); + return 0; + } + + return 1; +} + + +sub commonTagsHandler +{ +### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead + if( $_[0] =~ /%SLIDESHOWSTART/ ) { + _addHeader(); + require Foswiki::Plugins::SlideShowPlugin::SlideShow; + Foswiki::Plugins::SlideShowPlugin::SlideShow::init( $installWeb ); + $_[0] = Foswiki::Plugins::SlideShowPlugin::SlideShow::handler( @_ ); + } +} + +sub _addHeader { + + return if $addedHead; + $header .= <<'EOF'; + +EOF + Foswiki::Func::addToHEAD( 'SLIDESHOWPLUGIN', $header ); + $addedHead = 1; +} + +1; diff --git a/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/DEPENDENCIES b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/DEPENDENCIES new file mode 100644 index 0000000000..e69de29bb2 diff --git a/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/MANIFEST b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/MANIFEST new file mode 100644 index 0000000000..09670e85bc --- /dev/null +++ b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/MANIFEST @@ -0,0 +1,14 @@ +data/System/SlideShowPlugin.txt 0644 +data/System/VarSLIDESHOWEND.txt 0644 +data/System/VarSLIDESHOWSTART.txt 0644 +lib/Foswiki/Plugins/SlideShowPlugin.pm 0444 +lib/Foswiki/Plugins/SlideShowPlugin/SlideShow.pm 0444 +pub/System/SlideShowPlugin/endpres.gif 0644 +pub/System/SlideShowPlugin/first.gif 0644 +pub/System/SlideShowPlugin/last.gif 0644 +pub/System/SlideShowPlugin/logo.gif 0644 +pub/System/SlideShowPlugin/next.gif 0644 +pub/System/SlideShowPlugin/prev.gif 0644 +pub/System/SlideShowPlugin/startpres.gif 0644 +pub/System/SlideShowPlugin/slideshow.css 0644 +templates/view.slideshow.tmpl 0444 diff --git a/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/SlideShow.pm b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/SlideShow.pm new file mode 100644 index 0000000000..a532efbdd0 --- /dev/null +++ b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/SlideShow.pm @@ -0,0 +1,278 @@ +# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ +# +# Copyright (C) 2002-2007 Peter Thoeny, peter@thoeny.org +# Copyright (C) 2008-2009 Foswiki Contributors +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. For +# more details read LICENSE in the root of this distribution. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details, published at +# http://www.gnu.org/copyleft/gpl.html +# +# As per the GPL, removal of this notice is prohibited. + +use strict; +use Foswiki::Func; + +package Foswiki::Plugins::SlideShowPlugin::SlideShow; + +use vars qw( $imgRoot $installWeb ); + + +sub init +{ + $installWeb = shift; + $imgRoot = '%PUBURLPATH%/'.$installWeb.'/SlideShowPlugin'; +} + + +sub handler +{ + my( $text, $theTopic, $theWeb ) = @_; + + my $textPre = ""; + my $textPost = ""; + my $args = ""; + if( $text =~ /^(.*)%SLIDESHOWSTART%(.*)$/s ) { + $textPre = $1; + $text = $2; + } elsif( $text =~ /^(.*)%SLIDESHOWSTART{(.*?)}%(.*)$/s ) { + $textPre = $1; + $args = $2; + $text = $3; + } + if( $text =~ /^(.*)%SLIDESHOWEND%(.*)$/s ) { + $text = $1; + $textPost = $2; + } + + # Make sure we don't end up back in the handler again + # SMELL: there should be a better block + $text =~ s/%SLIDESHOW/%SLIDESHOW/g; + + my $query = Foswiki::Func::getCgiQuery(); + + # Build query string based on existingURL parameters + my $queryParams = '?slideshow=on;cover=slideshow'; + foreach my $name ( $query->param ) { + next if ( $name =~ /(text|keywords|web|topic|slideshow|skin|cover|\#)/ ); + $queryParams .= ';' . $name . '=' . urlEncode( $query->param($name) ); + } + + if( $query && $query->param( 'slideshow' ) ) { + # in presentation mode + + # do not write the topic text when in slideshow mode + $textPre = ''; + $textPost = ''; + + $textPre .= "\n#StartPresentation\n"; + $textPre .= renderSlideNav( $theWeb, $theTopic, 1, 1, "e", $queryParams ); + + my $slideMax = 0; + + if( $text =~ /(.*?[\n\r])\-\-\-+(\++)\!* (.*)/s ) { + $textPre .= $1; + $text = $3; + my $level = $2; + $level =~ s/\+/\\\+/go; + my @slides = split( /[\n\r]\-\-\-+$level\!* /, $text ); + $text = ""; + + my $hideComments = Foswiki::Func::isTrue(Foswiki::Func::getPreferencesValue( 'SLIDESHOWPLUGIN_HIDECOMMENTS' ) || ''); + + my $commentLabel = Foswiki::Func::getPreferencesValue( 'SLIDESHOWPLUGIN_COMMENTS_LABEL' ) || 'Comments'; + + my $tmplText = readTmplText( $theWeb, $args ); + my $slideText = ""; + my $slideTitle = ""; + my $slideBody = ""; + my $slideComment = ""; + my $slideNum = 1; + $slideMax = @slides; + my @titles = (); + foreach( @slides ) { + next unless /^([^\n\r]*)(.*)$/s; + $slideTitle = $1 || ''; + $slideBody = $2 || ''; + $slideComment = ''; + if( $slideBody =~ s/(\-\-\-+\+$level+\!*\s*$commentLabel.*)//is ) { + $slideComment = $1 if !$hideComments; + } + push( @titles, $slideTitle ); + $slideText = $tmplText; + $slideText =~ s/%SLIDETITLE%/$slideTitle/go; + $slideText =~ s/%SLIDETEXT%/$slideBody/go; + $slideText =~ s/%SLIDENUM%/$slideNum/go; + $slideText =~ s/%SLIDEMAX%/$slideMax/go; + $slideText =~ s/%SLIDENAV%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "fpn", $queryParams )/geo; + $slideText =~ s/%SLIDENAVALL%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "flpn", $queryParams )/geo; + $slideText =~ s/%SLIDENAVFIRST%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "f", $queryParams )/geo; + $slideText =~ s/%SLIDENAVPREV%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "p", $queryParams )/geo; + $slideText =~ s/%SLIDENAVNEXT%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "n", $queryParams )/geo; + $slideText =~ s/%SLIDENAVLAST%/renderSlideNav( + $theWeb, $theTopic, $slideNum, $slideMax, "l", $queryParams )/geo; + $text .= "\n#GoSlide$slideNum\n$slideText"; + unless( $text =~ s/%SLIDECOMMENT%/\n$slideComment\n/go ) { + $text .= "\n$slideComment\n" if( $slideComment ); + } + $slideNum++; + } + $text =~ s/%TOC(?:\{.*?\})*%/renderSlideToc( $theWeb, $theTopic, $queryParams, @titles )/geo; + $text .= "\n#GoSlide$slideNum\n"; + } + + $text = "$textPre\n$text\n"; + $text .= renderSlideNav( $theWeb, $theTopic, $slideMax + 1, $slideMax, "f p e", $queryParams ); + $text .= $textPost; + + } else { + # in normal topic view mode + if( $text =~ /[\n\r]\-\-\-+(\++)/s ) { + my $level = $1; + $level =~ s/\+/\\\+/go; + # add slide number to heading + my $slideNum = 1; + $text =~ s/([\n\r]\-\-\-+$level\!*) ([^\n\r]+)/"$1 Slide " . $slideNum++ . ": $2"/ges; + } + $text = "$textPre \n#StartPresentation\n" + . renderSlideNav( $theWeb, $theTopic, 1, 1, "s", $queryParams ) + . "\n$text $textPost"; + } + + return $text; +} + + +sub renderSlideNav +{ + my( $theWeb, $theTopic, $theNum, $theMax, $theButtons, $qstring ) = @_; + my $prev = $theNum - 1 || 1; + my $next = $theNum + 1; + my $text = ""; + my $viewUrl = Foswiki::Func::getViewUrl($theWeb, $theTopic); + + # format buttons + $theButtons =~ s/f/%BUTTON_FIRST%/; + $theButtons =~ s/l/%BUTTON_LAST%/; + $theButtons =~ s/p/%BUTTON_PREVIOUS%/; + $theButtons =~ s/n/%BUTTON_NEXT%/; + $theButtons =~ s/s/%BUTTON_START%/; + $theButtons =~ s/e/%BUTTON_END%/; + + # f + $theButtons =~ s/%BUTTON_FIRST%/htmlButton('First', "$viewUrl$qstring#GoSlide1", 'first.gif', 'First slide')/e; + + # l + $theButtons =~ s/%BUTTON_LAST%/htmlButton('Last', "$viewUrl$qstring#GoSlide$theMax", 'last.gif', 'Last slide')/e; + + # p + $theButtons =~ s/%BUTTON_PREVIOUS%/htmlButton('Previous', "$viewUrl$qstring#GoSlide$prev", 'prev.gif', 'Previous slide')/e; + + # n + $theButtons =~ s/%BUTTON_NEXT%/htmlButton('Next', "$viewUrl$qstring#GoSlide$next", 'next.gif', 'Next slide')/e; + + # s + $theButtons =~ s/%BUTTON_START%/htmlButton('Start', "$viewUrl$qstring#GoSlide1", 'startpres.gif', 'Start presentation')/e; + + # e + my $anchor = 'StartPresentation'; + $theButtons =~ s/%BUTTON_END%/htmlButton('End', "$viewUrl#$anchor", 'endpres.gif', 'End presentation')/e; + + $text .= $theButtons; + + $text .= ''; + return $text; +} + +sub htmlButton { + my ($id, $url, $imgName, $label) = @_; + + my $button = ''; + $button .= "$label<\/a>"; + + return $button; +} + + +sub renderSlideToc +{ + my( $theWeb, $theTopic, $params, @theTitles ) = @_; + + my $slideNum = 1; + my $text = ''; + my $viewUrl = Foswiki::Func::getViewUrl($theWeb, $theTopic); + foreach( @theTitles ) { + $text .= "\t\* "; + $text .= ""; + $text .= " $_ \n"; + $slideNum++; + } + return $text; +} + + +sub readTmplText +{ + my( $theWeb, $theArgs ) = @_; + + my $tmplTopic = Foswiki::Func::extractNameValuePair( $theArgs, "template" ); + unless( $tmplTopic ) { + $theWeb = $installWeb; + $tmplTopic = Foswiki::Func::getPreferencesValue( "SLIDESHOWPLUGIN_TEMPLATE" ) + || "SlideShowPlugin"; + } + if( $tmplTopic =~ /^([^\.]+)\.(.*)$/o ) { + $theWeb = $1; + $tmplTopic = $2; + } + my( $meta, $text ) = Foswiki::Func::readTopic( $theWeb, $tmplTopic ); + # remove everything before %STARTINCLUDE% and after %STOPINCLUDE% + $text =~ s/.*?%STARTINCLUDE%//os; + $text =~ s/%STOPINCLUDE%.*//os; + + unless( $text ) { + $text = htmlAlert("$installWeb.SlideShowPlugin Error:", + "Slide template topic $theWeb.$tmplTopic not found or empty!" + . "%SLIDETITLE%\n\n%SLIDETEXT%"); + } elsif( $text =~ /%SLIDETITLE%/ && $text =~ /%SLIDETEXT%/ ) { + # assume that format is OK + } else { + $text = htmlAlert("$installWeb.SlideShowPlugin Error:", + "Missing =%SLIDETITLE%= or =%SLIDETEXT%= in " + . "slide template topic $theWeb.$tmplTopic.\n\n" + . "%SLIDETITLE%\n\n%SLIDETEXT%"); + } + $text =~ s/%WEB%/$theWeb/go; + $text =~ s/%TOPIC%/$tmplTopic/go; + $text =~ s/%ATTACHURL%/%PUBURL%\/$theWeb\/$tmplTopic/go; + return $text; +} + +sub htmlAlert { + my ($alertMessage, $message) = @_; + + return "

$alertMessage

$message

"; + +} + +sub urlEncode +{ + my $text = shift; + $text =~ s/([^0-9a-zA-Z-_.:~!*'()\/%])/'%'.sprintf('%02x',ord($1))/ge; + $text =~ s/\%20/+/g; + return $text; +} + +1; diff --git a/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/build.pl b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/build.pl new file mode 100755 index 0000000000..aa2d482247 --- /dev/null +++ b/SlideShowPlugin/lib/Foswiki/Plugins/SlideShowPlugin/build.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w +# +# Build for SlideShowPlugin +# +BEGIN { + foreach my $pc (split(/:/, $ENV{FOSWIKI_LIBS})) { + unshift @INC, $pc; + } +} + +use Foswiki::Contrib::Build; + +# Create the build object +$build = new Foswiki::Contrib::Build( 'SlideShowPlugin' ); + +# Build the target on the command line, or the default target +$build->build($build->{target}); + diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/buttons.psd b/SlideShowPlugin/pub/System/SlideShowPlugin/buttons.psd new file mode 100644 index 0000000000..0a83e82d2f Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/buttons.psd differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.gif new file mode 100644 index 0000000000..2900262009 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.psd b/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.psd new file mode 100644 index 0000000000..32990febb7 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/endpres.psd differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/first.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/first.gif new file mode 100644 index 0000000000..e713956f34 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/first.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/last.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/last.gif new file mode 100644 index 0000000000..ba9dfe1764 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/last.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/logo.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/logo.gif new file mode 100644 index 0000000000..0c140109aa Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/logo.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/logo.psd b/SlideShowPlugin/pub/System/SlideShowPlugin/logo.psd new file mode 100644 index 0000000000..012b49ebc9 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/logo.psd differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/next.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/next.gif new file mode 100644 index 0000000000..a43561607b Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/next.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/prev.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/prev.gif new file mode 100644 index 0000000000..2effbc8075 Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/prev.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/slideshow.css b/SlideShowPlugin/pub/System/SlideShowPlugin/slideshow.css new file mode 100644 index 0000000000..20839592d1 --- /dev/null +++ b/SlideShowPlugin/pub/System/SlideShowPlugin/slideshow.css @@ -0,0 +1,49 @@ +.slideshow { + padding:.5em 1em 1em 1em; + height:1500px; +} +.slideshow .slideshowHeader { + border-bottom:1px solid #666; + padding:0 0 .5em 0; +} +.slideshow .slideshowToolbar { + color:#666; + margin:0; + padding:0 0 .25em 0; + text-align:right; + font-size:94%; +} +.slideshow .slideshowHeader p { + color:#666; + margin:0; + padding:0; + text-align:right; + font-size:94%; +} +.slideshow .slideshowHeader h1 { + color:#360; + margin:0; + padding:0; +} +.slideshow .slideshowContent { + padding:2em 0 1em 0; + font-size:150%; + line-height:150%; + height:400px; +} +.slideshow .slideshowComments, +.slideshow .slideshowComments h4 { + color:#888; +} +.slideshow .slideshowControls { + white-space:nowrap; + float:right; + clear:both; +} +.slideshow a.slideshowControlButton { + margin-left:5px; +} +a.slideshowControlButton:hover { + text-decoration:none; + background:none; +} diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.gif b/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.gif new file mode 100644 index 0000000000..331619fedb Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.gif differ diff --git a/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.psd b/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.psd new file mode 100644 index 0000000000..7477e2a79c Binary files /dev/null and b/SlideShowPlugin/pub/System/SlideShowPlugin/startpres.psd differ diff --git a/SlideShowPlugin/templates/view.slideshow.tmpl b/SlideShowPlugin/templates/view.slideshow.tmpl new file mode 100755 index 0000000000..28f4e3e9b5 --- /dev/null +++ b/SlideShowPlugin/templates/view.slideshow.tmpl @@ -0,0 +1,11 @@ +%TMPL:INCLUDE{"viewprint"}% +%TMPL:DEF{"form"}%%TMPL:END% +%TMPL:DEF{"attachments"}%%TMPL:END% +%TMPL:DEF{"standardheader"}%%TMPL:END% +%TMPL:DEF{"simpleheader"}%%TMPL:END% +%TMPL:DEF{"topicinfo"}%%TMPL:END% +%TMPL:DEF{"standardfooter"}%%TMPL:END% + +%TMPL:DEF{"content"}%%TEXT% +#TopicEnd +%TMPL:END% \ No newline at end of file