diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt
index 386b89f98..f37674742 100644
--- a/docs/changelog/7.x.x.txt
+++ b/docs/changelog/7.x.x.txt
@@ -9,6 +9,7 @@
- fixed: the export system was largely incomprehensible. rewritten.
- the new export system now needs Path::Class
- add: GalleryAlbum now shows link to add Photo
+ - add: More vars to GalleryAlbum and GalleryFile
7.5.10
- fix: Syntax error in GetCsMail
diff --git a/lib/WebGUI/Asset/File/GalleryFile.pm b/lib/WebGUI/Asset/File/GalleryFile.pm
index 9beb67796..cc8b2112a 100644
--- a/lib/WebGUI/Asset/File/GalleryFile.pm
+++ b/lib/WebGUI/Asset/File/GalleryFile.pm
@@ -389,6 +389,17 @@ sub getTemplateVars {
$var->{ $key } = $galleryVar->{ $key };
}
+ # More things from Gallery, but with different names
+ for my $key ( qw{ title menuTitle url } ) {
+ $var->{ "gallery_" . $key } = $galleryVar->{ $key };
+ }
+
+ # Add some things from Album
+ my $albumVar = $self->getParent->getTemplateVars;
+ for my $key ( qw{ title menuTitle url thumbnailUrl } ) {
+ $var->{ "album_" . $key } = $albumVar->{ $key };
+ }
+
# Add the search form
$self->getGallery->appendTemplateVarsSearchForm( $var );
diff --git a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm
index 65cc7655a..457fe471f 100644
--- a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm
+++ b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm
@@ -392,7 +392,7 @@ sub updateExifDataFromFile {
}
# Remove other, pointless keys
- for my $key ( qw( directory ) ) {
+ for my $key ( qw( Directory ) ) {
delete $info->{ $key };
}
diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm
index 8fafdfb8f..3159378cd 100644
--- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm
+++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm
@@ -408,6 +408,12 @@ sub getTemplateVars {
$var->{ url_listFilesForCurrentUser } = $gallery->getUrl('func=listFilesForUser');
$var->{ url_search } = $gallery->getUrl('func=search');
+ # Add some specific vars from the Gallery
+ my $galleryVar = $gallery->getTemplateVars;
+ for my $key ( qw{ title menuTitle url } ) {
+ $var->{ "gallery_" . $key } = $galleryVar->{ $key };
+ }
+
# Friendly URLs
$var->{ url } = $self->getUrl;
$var->{ url_addArchive } = $self->getUrl('func=addArchive');
diff --git a/lib/WebGUI/Help/Asset_GalleryAlbum.pm b/lib/WebGUI/Help/Asset_GalleryAlbum.pm
index 60448b31b..706443629 100644
--- a/lib/WebGUI/Help/Asset_GalleryAlbum.pm
+++ b/lib/WebGUI/Help/Asset_GalleryAlbum.pm
@@ -84,6 +84,18 @@ our $HELP = {
name => 'thumbnailUrl',
description => 'helpvar thumbnailUrl',
},
+ {
+ name => 'gallery_title',
+ description => 'helpvar gallery_title',
+ },
+ {
+ name => 'gallery_menuTitle',
+ description => 'helpvar gallery_menuTitle',
+ },
+ {
+ name => 'gallery_url',
+ description => 'helpvar gallery_url',
+ },
],
},
diff --git a/lib/WebGUI/Help/Asset_Photo.pm b/lib/WebGUI/Help/Asset_Photo.pm
index abd798a9f..2948ddba4 100644
--- a/lib/WebGUI/Help/Asset_Photo.pm
+++ b/lib/WebGUI/Help/Asset_Photo.pm
@@ -134,6 +134,34 @@ our $HELP = {
name => 'url_slideshow',
description => 'helpvar url_slideshow',
},
+ {
+ name => 'gallery_title',
+ description => 'helpvar gallery_title',
+ },
+ {
+ name => 'gallery_menuTitle',
+ description => 'helpvar gallery_menuTitle',
+ },
+ {
+ name => 'gallery_url',
+ description => 'helpvar gallery_url',
+ },
+ {
+ name => 'album_title',
+ description => 'helpvar album_title',
+ },
+ {
+ name => 'album_menuTitle',
+ description => 'helpvar album_menuTitle',
+ },
+ {
+ name => 'album_thumbnailUrl',
+ description => 'helpvar album_thumbnailUrl',
+ },
+ {
+ name => 'album_url',
+ description => 'helpvar album_url',
+ },
],
},
diff --git a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm
index f05c4eb97..065c1ccb9 100644
--- a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm
+++ b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm
@@ -465,6 +465,25 @@ our $I18N = {
lastUpdated => 0,
context => 'Title for the list of actions a user can take after saving a Gallery Album',
},
+
+ 'helpvar gallery_title' => {
+ message => q{The title of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar gallery_menuTitle' => {
+ message => q{The menu title of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar gallery_url' => {
+ message => q{The URL of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
};
1;
diff --git a/lib/WebGUI/i18n/English/Asset_Photo.pm b/lib/WebGUI/i18n/English/Asset_Photo.pm
index 427e12186..7b96ee171 100644
--- a/lib/WebGUI/i18n/English/Asset_Photo.pm
+++ b/lib/WebGUI/i18n/English/Asset_Photo.pm
@@ -589,6 +589,48 @@ our $I18N = {
context => q{Description of template variable},
},
+ 'helpvar gallery_title' => {
+ message => q{The title of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar gallery_menuTitle' => {
+ message => q{The menu title of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar gallery_url' => {
+ message => q{The URL of the Gallery containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar album_title' => {
+ message => q{The title of the album containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar album_menuTitle' => {
+ message => q{The menu title of the album containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar album_url' => {
+ message => q{The URL of the album containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
+ 'helpvar album_thumbnailUrl' => {
+ message => q{The URL for the thumbnail of the album containing this File},
+ lastUpdated => 0,
+ context => q{Description of template variable},
+ },
+
};
1;
diff --git a/t/Asset/File/GalleryFile/Photo/exif.t b/t/Asset/File/GalleryFile/Photo/exif.t
index 51e8938d7..1503c53f5 100644
--- a/t/Asset/File/GalleryFile/Photo/exif.t
+++ b/t/Asset/File/GalleryFile/Photo/exif.t
@@ -54,6 +54,10 @@ for my $key ( keys %$exif ) {
delete $exif->{$key};
}
}
+# Also remove things that Photo explicitly removed
+for my $key ( qw{ Directory } ) {
+ delete $exif->{ $key };
+}
$photo->setFile( WebGUI::Test->getTestCollateralPath("lamp.jpg") );
diff --git a/t/Asset/File/GalleryFile/Photo/view.t b/t/Asset/File/GalleryFile/Photo/view.t
index 0a7d93380..d9a645f52 100644
--- a/t/Asset/File/GalleryFile/Photo/view.t
+++ b/t/Asset/File/GalleryFile/Photo/view.t
@@ -88,18 +88,41 @@ my $testTemplateVars = {
numberOfComments => scalar @{ $photo->getCommentIds },
resolutions_loop => ignore(), # Tested elsewhere
exifLoop => ignore(), # Tested elsewhere
+
# Gallery stuff
url_search => $gallery->getUrl('func=search'),
url_listFilesForCurrentUser => $gallery->getUrl('func=listFilesForUser'),
+ gallery_title => $gallery->get('title'),
+ gallery_menuTitle => $gallery->get('menuTitle'),
+ gallery_url => $gallery->getUrl,
+ # Album stuff
+ album_title => $album->get('title'),
+ album_menuTitle => $album->get('menuTitle'),
+ album_url => $album->getUrl,
+ album_thumbnailUrl => $album->getThumbnailUrl,
};
-# Ignore all EXIF tags
+
+# Ignore all EXIF tags, they're tested in exif.t
for my $tag ( keys %{ $photo->getExifData } ) {
$testTemplateVars->{ 'exif_' . $tag } = ignore();
}
# Add search vars
$gallery->appendTemplateVarsSearchForm( $testTemplateVars );
+# Fix vars that are time-sensitive
+$testTemplateVars->{ searchForm_creationDate_before }
+ = all(
+ re( qr/{ searchForm_creationDate_after }
+ = all(
+ re( qr/getTemplateVars,
$testTemplateVars,