Changeset 6295


Ignore:
Timestamp:
02/12/10 17:28:21 (2 years ago)
Author:
MichaelDaum
Message:

Item176: optionally render galleries using a jQuery slimbox fronted

Location:
trunk/ImageGalleryPlugin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ImageGalleryPlugin/data/System/ImageGalleryPlugin.txt

    r4425 r6295  
    1 %META:TOPICINFO{author="ProjectContributor" date="1234443922" format="1.1"  version="1.2"}% 
     1%META:TOPICINFO{author="ProjectContributor" date="1252914561" format="1.1" version="1.3"}% 
    22---+!! <nop>ImageGalleryPlugin 
    33<table style="float:right"> 
     
    4040| include | regular expression an image must match to be part of the gallery | 
    4141| exclude | regular expression an image must _not_ match to be part of the gallery | 
     42| frontend | select gallery interface, possible values are =lightbox= and =default=; \ 
     43             (defaults to =lightbox= if Foswiki:Extensions/JQueryPlugin is installed and =default= otherwise) | 
    4244| field | specify which property of the image has to match using =include= or =exclude=; \ 
    4345          possible values: name, comment (default: name) | 
     
    5658            limit while preserving aspect ratio %BR% (default: 0) | 
    5759| minheight | minimal display height of an image %BR% (default: 0) | 
     60| header | header part of the gallery; only used if there is a =format= | 
    5861| format | html format of an image %BR% \ 
    5962          (default: &lt;a href="$origurl"&gt;&lt;img src="$imageurl" title="$comment" width="$width" height="$height"/&gt;&lt;/a&gt;) | 
     63| footer | footer part of the gallery; only used if there is a =format= | 
    6064| titles | toggles image and thumnail titles on and off %BR% \ 
    61           (default: on) | 
     65          (default: off) | 
    6266| title | html format of an image title; "off" will hide the image's title %BR% \ 
    63           (default: $comment ($imgnr/$nrimgs)&nbsp;$reddot) | 
     67          (default: $comment ($imgnr/$nrimgs)) | 
    6468| thumbtitle  | html format of a thumbnail title; "off" will hide the thumbnail's title %BR% \ 
    65           (default: $comment&nbsp;$reddot) | 
     69          (default: $comment) | 
    6670| sort | set the initial order of the images, can be name, date, size or comment (default:date) | 
    6771| reverse | invert the initial order of the images, can be on or off (default:off) | 
     
    7882| $nrimages | the total number of images in the gallery | 
    7983| $n | a linefeed | 
    80 | $reddot | render a red-dot anchor to access the attachment | 
    8184| $width | the display width of the image | 
    8285| $height | the display height of the image | 
     
    139142prefix the comment of the attachment with a sequence number. For example: given a 
    140143picture whose comment is "My old bike" that should be put at position 12 
    141 in your image gallery then change the comment to "12 - My old bike". This 
     144in your image gallery then change the comment to "12 <nop>- My old bike". This 
    142145will put the image at the desired position. Sequence numbers don't necessarily need 
    143146to be unique, that is if there's another picture with a comment like  
    144 "12 - My new bike" then the natural order of the both is relevant. In general, 
     147"12 <nop>- My new bike" then the natural order of the both is relevant. In general, 
    145148a picture will be put at position =&lt;nr&gt;= if its attachment comment has the format 
    146149<verbatim> 
     
    158161--> 
    159162|  Plugin Author: | Michael Daum, Will Norris | 
    160 |  Copyright &copy;: | 2002-2009, Will Norris; 2005-2009, Michael Daum http://michaeldaumconsulting.com | 
     163|  Copyright &copy;: | 2002-2009, Will Norris; 2005-2010, Michael Daum http://michaeldaumconsulting.com | 
    161164|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    162165|  Release: | %$RELEASE% | 
    163166|  Version: | %$VERSION% | 
    164167|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
     168|  12 Feb 2010 | new =frontend= parameter defaulting to "lightbox" when Foswiki:Extensions/JQueryPlugin is installed |  
    165169|  03 Jul 2009 | shipping minified and compressed css files now | 
    166170|  24 Apr 2009 | converted to foswiki plugin | 
     
    191195|  10 May 2005 | fixed igp id clash error found by Martin Cleaver; \ 
    192196                 capture <nop>ImageMagick error messages; \ 
    193                  don't trust attachment info - check for attachment existence as well;\ 
     197                 don't trust attachment info, check for attachment existence as well;\ 
    194198                 added refresh query parameter to recompute images | 
    195199|  09 May 2005 | fixed errors reported by Marcel Trap; \ 
  • trunk/ImageGalleryPlugin/lib/Foswiki/Plugins/ImageGalleryPlugin.pm

    r4425 r6295  
    11# Copyright (C) 2002-2009 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 
    2 # Copyright (C) 2005-2009 Michael Daum http://michaeldaumconsulting.com 
     2# Copyright (C) 2005-2010 Michael Daum http://michaeldaumconsulting.com 
    33# 
    44# This program is free software; you can redistribute it and/or 
     
    2424 
    2525$VERSION = '$Rev$'; 
    26 $RELEASE = '5.01'; 
     26$RELEASE = '5.10'; 
    2727$NO_PREFS_IN_TOPIC = 1; 
    2828$SHORTDESCRIPTION = 'Displays image gallery with auto-generated thumbnails from attachments'; 
  • trunk/ImageGalleryPlugin/lib/Foswiki/Plugins/ImageGalleryPlugin/Core.pm

    r4425 r6295  
    22# 
    33# Copyright (C) 2002-2009 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 
    4 # Copyright (C) 2005-2009 Michael Daum http://michaeldaumconsulting.com 
     4# Copyright (C) 2005-2010 Michael Daum http://michaeldaumconsulting.com 
    55# 
    66# This program is free software; you can redistribute it and/or 
     
    1919 
    2020use strict; 
     21use Foswiki::Func (); 
     22use Foswiki::Plugins (); 
    2123use constant DEBUG => 0; # toggle me 
    2224use vars qw(%imageSuffixes); 
     
    4244 
    4345  $this->{id} = $id; 
     46  $this->{session} = $Foswiki::Plugins::SESSION; 
    4447  $this->{query} = Foswiki::Func::getCgiQuery(); 
    4548  $this->{topic} = $topic; 
     
    180183  $this->{minwidth} = $this->{maxwidth} if $this->{minwidth} > $this->{maxwidth}; 
    181184  $this->{format} = $params->{format}; 
     185  $this->{frontend} = $params->{frontend}; 
     186  $this->{header} = $params->{header}; 
     187  $this->{footer} = $params->{footer}; 
    182188  $this->{title} = $params->{title} || ' $comment ($imgnr/$nrimgs)'; 
    183189  $this->{doTitles} = ($this->{title} eq 'off')?0:1; 
     
    216222  $this->{reverse} = $params->{rev} || $params->{reverse} || 'off'; 
    217223  $this->{reverse} = 'off' unless $this->{reverse} =~ /^on|off$/; 
     224 
     225  unless (defined $this->{frontend}) { 
     226    $this->{frontend} = (Foswiki::Func::getContext()->{JQueryPluginEnabled})?'lightbox':'default'; 
     227  } 
    218228 
    219229  return 1; 
     
    275285  my $id = $this->{query}->param("id") || ''; 
    276286 
    277   if ($this->{format}) { 
     287  if ($this->{frontend} eq 'lightbox') { 
     288    require Foswiki::Plugins::JQueryPlugin; 
     289    Foswiki::Plugins::JQueryPlugin::createPlugin('slimbox'); 
     290    $this->{header} = "<noautolink><div class=\"igp jqSlimbox {itemSelector:'.igpThumbNail', singleMode:true}\" id='igp$this->{id}'>\n<a name='igp$this->{id}'></a>\n"; 
     291    $this->{footer} = "<span class='foswikiClear'></span></div></noautolink>"; 
     292    $this->{format} = "<a href='\$imageurl' class='igpThumbNail {origurl:\"\$origurl\"}' title='\$comment'><img src='\$thumburl' alt='\$name' /></a>" 
     293      unless defined $this->{format}; 
     294    $result = $this->renderFormatted(); 
     295  } elsif ($this->{format}) { 
    278296    $result = $this->renderFormatted(); 
    279297  } else { 
     
    333351    $result .= 
    334352      "<link rel='parent' href='". 
    335        Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view'). 
     353       $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}). 
    336354      "' title='Thumbnails' />\n"; 
    337355    if ($firstImg && $firstImg->{name} ne $filename) { 
    338356      $result .= 
    339357        "<link rel='first' href='". 
    340         Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     358        $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    341359          'id'=>$this->{id}, 
    342360          'filename'=>$firstImg->{name}, 
     
    347365      $result .= 
    348366          "<link rel='last' href='". 
    349           Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     367          $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    350368            'id'=>$this->{id}, 
    351369            'filename'=>$lastImg->{name}, 
     
    356374      $result .= 
    357375          "<link rel='next' href='". 
    358           Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     376          $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    359377            'id'=>$this->{id}, 
    360378            'filename'=>$nextImg->{name}, 
     
    365383      $result .= 
    366384        "<link rel='previous' href='". 
    367         Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     385        $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    368386          'id'=>$this->{id}, 
    369387          'filename'=>$prevImg->{name}, 
     
    401419  if ($firstImg && $firstImg->{name} ne $filename) { 
    402420    $result .= "<a class='igpNaviFirst' title='go to first' href='". 
    403     Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     421    $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    404422      'id'=>$this->{id}, 
    405423      'filename'=>$firstImg->{name}, 
     
    411429  if ($prevImg) { 
    412430    $result .= "<a class='igpNaviPrev' title='go to previous' href='". 
    413     Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     431    $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    414432      'id'=>$this->{id}, 
    415433      'filename'=>$prevImg->{name}, 
     
    421439  if ($nextImg) { 
    422440    $result .= "<a class='igpNaviNext' title='go to next' href='". 
    423     Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     441    $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    424442      'id'=>$this->{id}, 
    425443      'filename'=>$nextImg->{name}, 
     
    431449  if ($lastImg && $lastImg->{name} ne $filename) { 
    432450    $result .= "<a class='igpNaviLast' title='go to last' href='". 
    433     Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view', 
     451    $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 
    434452      'id'=>$this->{id}, 
    435453      'filename'=>$lastImg->{name}, 
     
    440458  } 
    441459  $result .= "<a class='igpNaviDone' href='". 
    442     Foswiki::Func::getScriptUrl($this->{web},$this->{topic}, 'view', "#"=>"igp$this->{id}"). 
     460    $this->{session}->getScriptUrl(0, 'view', $this->{web},$this->{topic}, "#"=>"igp$this->{id}"). 
    443461    "'><span>done</span></a>"; 
    444462 
     
    823841    $format =~ s/\$web/$image->{IGP_web}/gos; 
    824842    $format =~ s/\$topic/$image->{IGP_topic}/gos; 
     843    $format =~ s/\$id/$this->{id}/gos; 
    825844 
    826845  } 
  • trunk/ImageGalleryPlugin/lib/Foswiki/Plugins/ImageGalleryPlugin/DEPENDENCIES

    r3681 r6295  
    11Image::Magick,>=6.2.4.5,cpan,Required. 
    22Graphics::Magick,>=1.1.11,cpan,Optional. 
     3Foswiki::Plugins::JQueryPlugin,>=6283,perl,Optional 
    34 
  • trunk/ImageGalleryPlugin/pub/System/ImageGalleryPlugin/style.css

    r4425 r6295  
    1212.igpNaviNext{background-image:url(control-right.png);}.igpNaviLast:hover, 
    1313.igpNaviLast{background-image:url(control-end.png);}.igpNaviFirst.igpNaviDisabled{background-image:url(control-start-gray.png);}.igpNaviPrev.igpNaviDisabled{background-image:url(control-left-gray.png);}.igpNaviNext.igpNaviDisabled{background-image:url(control-right-gray.png);}.igpNaviLast.igpNaviDisabled{background-image:url(control-end-gray.png);}.igpNaviDone:hover, 
    14 .igpNaviDone{background-image:url(cross.png);} 
     14.igpNaviDone{background-image:url(cross.png);}.jqSlimbox .igpThumbNail{float:left;padding:5px;} 
  • trunk/ImageGalleryPlugin/pub/System/ImageGalleryPlugin/style.uncompressed.css

    r4425 r6295  
    107107} 
    108108 
     109.jqSlimbox .igpThumbNail { 
     110  float:left; 
     111  padding:5px; 
     112} 
Note: See TracChangeset for help on using the changeset viewer.