- Timestamp:
- 02/12/10 17:28:21 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ImageGalleryPlugin/lib/Foswiki/Plugins/ImageGalleryPlugin/Core.pm
r4425 r6295 2 2 # 3 3 # Copyright (C) 2002-2009 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 4 # Copyright (C) 2005-20 09Michael Daum http://michaeldaumconsulting.com4 # Copyright (C) 2005-2010 Michael Daum http://michaeldaumconsulting.com 5 5 # 6 6 # This program is free software; you can redistribute it and/or … … 19 19 20 20 use strict; 21 use Foswiki::Func (); 22 use Foswiki::Plugins (); 21 23 use constant DEBUG => 0; # toggle me 22 24 use vars qw(%imageSuffixes); … … 42 44 43 45 $this->{id} = $id; 46 $this->{session} = $Foswiki::Plugins::SESSION; 44 47 $this->{query} = Foswiki::Func::getCgiQuery(); 45 48 $this->{topic} = $topic; … … 180 183 $this->{minwidth} = $this->{maxwidth} if $this->{minwidth} > $this->{maxwidth}; 181 184 $this->{format} = $params->{format}; 185 $this->{frontend} = $params->{frontend}; 186 $this->{header} = $params->{header}; 187 $this->{footer} = $params->{footer}; 182 188 $this->{title} = $params->{title} || ' $comment ($imgnr/$nrimgs)'; 183 189 $this->{doTitles} = ($this->{title} eq 'off')?0:1; … … 216 222 $this->{reverse} = $params->{rev} || $params->{reverse} || 'off'; 217 223 $this->{reverse} = 'off' unless $this->{reverse} =~ /^on|off$/; 224 225 unless (defined $this->{frontend}) { 226 $this->{frontend} = (Foswiki::Func::getContext()->{JQueryPluginEnabled})?'lightbox':'default'; 227 } 218 228 219 229 return 1; … … 275 285 my $id = $this->{query}->param("id") || ''; 276 286 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}) { 278 296 $result = $this->renderFormatted(); 279 297 } else { … … 333 351 $result .= 334 352 "<link rel='parent' href='". 335 Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view').353 $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}). 336 354 "' title='Thumbnails' />\n"; 337 355 if ($firstImg && $firstImg->{name} ne $filename) { 338 356 $result .= 339 357 "<link rel='first' href='". 340 Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view',358 $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 341 359 'id'=>$this->{id}, 342 360 'filename'=>$firstImg->{name}, … … 347 365 $result .= 348 366 "<link rel='last' href='". 349 Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view',367 $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 350 368 'id'=>$this->{id}, 351 369 'filename'=>$lastImg->{name}, … … 356 374 $result .= 357 375 "<link rel='next' href='". 358 Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view',376 $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 359 377 'id'=>$this->{id}, 360 378 'filename'=>$nextImg->{name}, … … 365 383 $result .= 366 384 "<link rel='previous' href='". 367 Foswiki::Func::getScriptUrl($this->{web}, $this->{topic}, 'view',385 $this->{session}->getScriptUrl(0, 'view', $this->{web}, $this->{topic}, 368 386 'id'=>$this->{id}, 369 387 'filename'=>$prevImg->{name}, … … 401 419 if ($firstImg && $firstImg->{name} ne $filename) { 402 420 $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}, 404 422 'id'=>$this->{id}, 405 423 'filename'=>$firstImg->{name}, … … 411 429 if ($prevImg) { 412 430 $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}, 414 432 'id'=>$this->{id}, 415 433 'filename'=>$prevImg->{name}, … … 421 439 if ($nextImg) { 422 440 $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}, 424 442 'id'=>$this->{id}, 425 443 'filename'=>$nextImg->{name}, … … 431 449 if ($lastImg && $lastImg->{name} ne $filename) { 432 450 $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}, 434 452 'id'=>$this->{id}, 435 453 'filename'=>$lastImg->{name}, … … 440 458 } 441 459 $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}"). 443 461 "'><span>done</span></a>"; 444 462 … … 823 841 $format =~ s/\$web/$image->{IGP_web}/gos; 824 842 $format =~ s/\$topic/$image->{IGP_topic}/gos; 843 $format =~ s/\$id/$this->{id}/gos; 825 844 826 845 }
Note: See TracChangeset
for help on using the changeset viewer.
