- Timestamp:
- 11/14/08 12:11:05 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ImageGalleryPlugin/lib/TWiki/Plugins/ImageGalleryPlugin/Core.pm
r424 r653 1 #2 # TWiki WikiClone ($wikiversion has version info)3 #4 1 # Copyright (C) 2002-2003 Will Norris. All Rights Reserved. (wbniv@saneasylumstudios.com) 5 2 # Copyright (C) 2005-2008 Michael Daum http://michaeldaumconsulting.com … … 176 173 $this->{minwidth} = $params->{minwidth} || 0; 177 174 $this->{minwidth} = $this->{maxwidth} if $this->{minwidth} > $this->{maxwidth}; 178 $this->{format} = $params->{format} || 179 '<a href="$origurl"><img src="$imageurl" title="$comment" width="$width" height="$height"/></a>'; 175 $this->{format} = $params->{format}; 180 176 $this->{title} = $params->{title} || ' $comment ($imgnr/$nrimgs) $reddot'; 181 177 $this->{doTitles} = ($this->{title} eq 'off')?0:1; … … 267 263 join(', ', $this->{info}{topics}{value}) ne join(', ', @{$this->{topics}}); 268 264 269 my $result = "<div class=\"igp\"><a name=\"igp$this->{id}\"></a>";265 my $result; 270 266 271 267 # get filename query string … … 273 269 my $id = $this->{query}->param("id") || ''; 274 270 275 if ($id eq $this->{id} && $filename) { 276 # picture mode 277 $result .= $this->renderImage($filename); 271 if ($this->{format}) { 272 $result = $this->renderFormatted(); 278 273 } else { 279 # thumbnails mode 280 $result .= $this->renderThumbnails(); 281 } 282 283 $result .= "</div>\n"; 274 $result = "<div class=\"igp\"><a name=\"igp$this->{id}\"></a>"; 275 if ($id eq $this->{id} && $filename) { 276 # picture mode 277 $result .= $this->renderImage($filename); 278 } else { 279 # thumbnails mode 280 $result .= $this->renderThumbnails(); 281 } 282 $result .= "</div>\n"; 283 $result = '<noautolink>'.$result.'</noautolink>'; 284 } 285 284 286 285 287 $this->writeInfo(); 286 return '<noautolink>'.$result.'</noautolink>'; 288 289 #writeDebug("result=$result"); 290 return $result; 287 291 } 288 292 … … 368 372 369 373 # img 374 my $imgFormat = '<a href="$origurl"><img src="$imageurl" title="$comment" width="$width" height="$height"/></a>'; 370 375 $result .= "<tr><td class=\"igpPicture\">" 371 . $this->replaceVars($ this->{format}, $thisImg);376 . $this->replaceVars($imgFormat, $thisImg); 372 377 373 378 # navi … … 416 421 417 422 # ========================= 418 sub renderThumbnails { 419 423 sub renderFormatted { 420 424 my $this = shift; 421 422 #writeDebug("renderThumbnails()");425 426 writeDebug("renderFormatted()"); 423 427 424 428 if (!@{$this->{images}}) { … … 427 431 428 432 my $maxCols = $this->{columns}; 429 my $result = "<div class=\"igpThumbNails\"><table class=\"igpThumbNailsTable\"><tr>\n"; 433 my $header = $this->{header} || ''; 434 my $footer = $this->{footer} || ''; 435 my $format = $this->{format} || ' * $imageurl'; 436 my $separator = $this->{separator}; 437 438 $separator = "\n" unless defined $separator; 439 my @result; 440 441 my $imageNr = 0; 442 my @rowOfImages = (); 443 my $skip = $this->{skip}; 444 foreach my $image (@{$this->{images}}) { 445 446 $skip--; 447 next if $skip >= 0; 448 last if $this->{limit} && $imageNr >= $this->{limit}; 449 $imageNr++; 450 451 $this->computeImageSize($image); 452 if (!$this->createImg($image)) { 453 return renderError($this->{errorMsg}); 454 } 455 if (!$this->createImg($image, 1)) { 456 return renderError($this->{errorMsg}); 457 } 458 459 460 my $line = $this->replaceVars($format, $image); 461 $line =~ s/\$index/$imageNr/g; 462 push @result, $line; 463 464 465 } 466 return $header.join($separator, @result).$footer; 467 } 468 469 # ========================= 470 sub renderThumbnails { 471 472 my $this = shift; 473 474 writeDebug("renderThumbnails()"); 475 476 if (!@{$this->{images}}) { 477 return renderError($this->{warn}); 478 } 479 480 my $maxCols = $this->{columns}; 481 my $result = "<div class='igpThumbNails'><table class='igpThumbNailsTable'><tr>"; 430 482 my $imageNr = 0; 431 483 my @rowOfImages = (); … … 758 810 $format =~ s/\$wikiusername/$image->{user}/gos; 759 811 $format =~ s/\$username/TWiki::Func::wikiToUserName($image->{user})/geos; 760 $format =~ s ,\$thumburl,$this->{imagesPubUrl}/thumb_$imageName,gos;761 $format =~ s ,\$imageurl,$this->{imagesPubUrl}/$imageName,gos;762 $format =~ s ,\$origurl,$image->{IGP_url},gos;812 $format =~ s/\$thumburl/$this->{imagesPubUrl}\/thumb_$imageName/gos; 813 $format =~ s/\$imageurl/$this->{imagesPubUrl}\/$imageName/gos; 814 $format =~ s/\$origurl/$image->{IGP_url}/gos; 763 815 $format =~ s/\$web/$image->{IGP_web}/gos; 764 816 $format =~ s/\$topic/$image->{IGP_topic}/gos; … … 983 1035 } 984 1036 985 986 987 1037 1;
Note: See TracChangeset
for help on using the changeset viewer.
