diff --git a/docs/upgrades/templates-7.5.0/root_import_gallery-templates-2.wgpkg b/docs/upgrades/templates-7.5.0/root_import_gallery-templates-2.wgpkg deleted file mode 100644 index 8b71ce9d9..000000000 Binary files a/docs/upgrades/templates-7.5.0/root_import_gallery-templates-2.wgpkg and /dev/null differ diff --git a/docs/upgrades/templates-7.5.0/root_import_gallery-templates.wgpkg b/docs/upgrades/templates-7.5.0/root_import_gallery-templates.wgpkg new file mode 100644 index 000000000..19f52f753 Binary files /dev/null and b/docs/upgrades/templates-7.5.0/root_import_gallery-templates.wgpkg differ diff --git a/docs/upgrades/upgrade_7.4.18-7.5.0.pl b/docs/upgrades/upgrade_7.4.18-7.5.0.pl index 3e95a300b..c08072f1a 100644 --- a/docs/upgrades/upgrade_7.4.18-7.5.0.pl +++ b/docs/upgrades/upgrade_7.4.18-7.5.0.pl @@ -390,6 +390,3 @@ sub createNewTemplatesFolder { return $newFolder; } - - ->>>>>>> .merge-right.r5144 diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 2f62447e3..33ba9019f 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -564,14 +564,18 @@ sub view_thumbnails { #---------------------------------------------------------------------------- -=head2 www_addArchive ( ) +=head2 www_addArchive ( params ) -Show the form to add an archive of files to this gallery. +Show the form to add an archive of files to this gallery. C is a hash +reference of parameters with the following keys: + + error => An error message to show to the user. =cut sub www_addArchive { my $self = shift; + my $params = shift; return $self->session->privilege->insufficient unless $self->canAddFile; @@ -579,6 +583,8 @@ sub www_addArchive { my $form = $self->session->form; my $var = $self->getTemplateVars; + $var->{ error } = $params->{ error }; + $var->{ form_start } = WebGUI::Form::formHeader( $session, { action => $self->getUrl('func=addArchiveSave'), @@ -639,6 +645,11 @@ sub www_addArchiveSave { my $storageId = $form->get("archive", "File"); my $storage = WebGUI::Storage->get( $session, $storageId ); + if (!$storage) { + return $self->www_addArchive({ + error => sprintf $i18n->get('addArchive error too big'), + }); + } my $filename = $storage->getPath( $storage->getFiles->[0] ); $self->addArchive( $filename, $properties ); diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm index 5ae3c2930..aec12f86b 100644 --- a/lib/WebGUI/AssetPackage.pm +++ b/lib/WebGUI/AssetPackage.pm @@ -276,12 +276,12 @@ Returns a tarball file for the user to download containing the package data. =cut sub www_exportPackage { - my $self = shift; - return $self->session->privilege->insufficient() unless ($self->get("isPackage") && $self->canEdit && $self->session->user->isInGroup(4)); - my $storage = $self->exportPackage; - my $filename = $storage->getFiles->[0]; - $self->session->http->setRedirect($storage->getUrl($storage->getFiles->[0])); - return "redirect"; + my $self = shift; + return $self->session->privilege->insufficient() unless ($self->get("isPackage") && $self->canEdit && $self->session->user->isInGroup(4)); + my $storage = $self->exportPackage; + my $filename = $storage->getFiles->[0]; + $self->session->http->setRedirect($storage->getUrl($storage->getFiles->[0])); + return "redirect"; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index 9caab81fe..305711440 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -84,60 +84,65 @@ sub handler { my ($session) = @_; my ($errorHandler, $http, $var, $asset, $request, $config) = $session->quick(qw(errorHandler http var asset request config)); my $output = ""; - if ($errorHandler->canShowPerformanceIndicators) { #show performance indicators if required - my $t = [Time::HiRes::gettimeofday()]; - $output = page($session); - $t = Time::HiRes::tv_interval($t) ; - if ($output =~ /<\/title>/) { - $output =~ s/<\/title>/ : ${t} seconds<\/title>/i; - } - else { - # Kludge. - my $mimeType = $http->getMimeType(); - if ($mimeType eq 'text/css') { - $session->output->print("\n/* Page generated in $t seconds. */\n"); - } - elsif ($mimeType eq 'text/html') { - $session->output->print("\nPage generated in $t seconds.\n"); - } - else { - # Don't apply to content when we don't know how - # to modify it semi-safely. - } - } - } + if ($errorHandler->canShowPerformanceIndicators) { #show performance indicators if required + my $t = [Time::HiRes::gettimeofday()]; + $output = page($session); + $t = Time::HiRes::tv_interval($t) ; + if ($output =~ /<\/title>/) { + $output =~ s/<\/title>/ : ${t} seconds<\/title>/i; + } else { + # Kludge. + my $mimeType = $http->getMimeType(); + if ($mimeType eq 'text/css') { + $session->output->print("\n/* Page generated in $t seconds. */\n"); + } + elsif ($mimeType eq 'text/html') { + $session->output->print("\nPage generated in $t seconds.\n"); + } + else { + # Don't apply to content when we don't know how + # to modify it semi-safely. + } + } + } + else { - my $asset = getAsset($session, getRequestedAssetUrl($session)); + my $asset = getAsset($session, getRequestedAssetUrl($session)); - # display from cache if page hasn't been modified. - if ($var->get("userId") eq "1" && defined $asset && !$http->ifModifiedSince($asset->getContentLastModified)) { - $http->setStatus("304","Content Not Modified"); - $http->sendHeader; - $session->close; - return Apache2::Const::OK; - } + # display from cache if page hasn't been modified. + if ($var->get("userId") eq "1" && defined $asset && !$http->ifModifiedSince($asset->getContentLastModified)) { + $http->setStatus("304","Content Not Modified"); + $http->sendHeader; + $session->close; + return Apache2::Const::OK; + } + + # return the page. + else { + $output = page($session, undef, $asset); + } + } + + my $filename = $http->getStreamedFile(); + if ((defined $filename) && ($config->get("enableStreamingUploads") eq "1")) { + my $ct = guess_media_type($filename); + my $oldContentType = $request->content_type($ct); + if ($request->sendfile($filename) ) { + $session->close; + return Apache2::Const::OK; + } + else { + $request->content_type($oldContentType); + } + } + + # Uhm... why here and not somewhere else? Do content handlers manage their own content + # or should the URL handlers do it for them? + if ($output eq "redirect") { + $http->sendHeader; + } - # return the page. - else { - $output = page($session, undef, $asset); - } - } - my $filename = $http->getStreamedFile(); - if ((defined $filename) && ($config->get("enableStreamingUploads") eq "1")) { - my $ct = guess_media_type($filename); - my $oldContentType = $request->content_type($ct); - if ($request->sendfile($filename) ) { - $session->close; - return Apache2::Const::OK; - } else { - $request->content_type($oldContentType); - } - } - $http->sendHeader(); #http object will only send the header once per request, so if the above sent a header as part of it's operation, this will do nothing. - unless ($http->isRedirect()) { - $session->output->print($output); - } # ... return $output; } diff --git a/lib/WebGUI/Help/Asset_GalleryAlbum.pm b/lib/WebGUI/Help/Asset_GalleryAlbum.pm index 25cc4598a..5d24a4039 100644 --- a/lib/WebGUI/Help/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/Help/Asset_GalleryAlbum.pm @@ -176,6 +176,11 @@ our $HELP = { }, ], variables => { + { + name => 'error', + description => 'helpvar error', + required => 1, + }, { name => 'form_start', description => 'helpvar form_start', diff --git a/lib/WebGUI/Help/Asset_Photo.pm b/lib/WebGUI/Help/Asset_Photo.pm index 9a733ed42..7943361f8 100644 --- a/lib/WebGUI/Help/Asset_Photo.pm +++ b/lib/WebGUI/Help/Asset_Photo.pm @@ -207,7 +207,8 @@ our $HELP = { required => 1, }, ], - } + }, + 'help view' => { title => 'help view title', body => 'help view body', diff --git a/lib/WebGUI/URL/Content.pm b/lib/WebGUI/URL/Content.pm index 6f4c88fb7..7bc4c5837 100644 --- a/lib/WebGUI/URL/Content.pm +++ b/lib/WebGUI/URL/Content.pm @@ -68,15 +68,15 @@ sub handler { $session->http->sendHeader(); $session->output->print($output) } - if ($session->errorHandler->canShowDebug()) { - $session->output->print($session->errorHandler->showDebug(),1); - } + if ($session->errorHandler->canShowDebug()) { + $session->output->print($session->errorHandler->showDebug(),1); + } } last; } } - } - WebGUI::Affiliate::grabReferral($session); # process affiliate tracking request + } + WebGUI::Affiliate::grabReferral($session); # process affiliate tracking request $session->close; return Apache2::Const::OK; }); diff --git a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm index 7724c47fc..833558c6a 100644 --- a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm @@ -294,6 +294,16 @@ our $I18N = { lastUpdated => 0, }, + 'helpvar error' => { + message => 'An error message to show the user. Only defined when something went wrong.', + lastUpdated => 0, + }, + + 'addArchive error too big' => { + message => 'The archive you are trying to upload is too big. Please try again.', + lastUpdated => 0, + }, + }; 1;