Added internal redirect
(Is there a way to get content_type that wouldn't require File::MMagic?) Apache2::SubRequest's method lookup_file coused segfault in apache, so I scrapped that and used File::MMagic to to content type determing Also fixed credit and added a currentPage.rankIsN variable to navigation
This commit is contained in:
parent
a9c3387cb1
commit
1f78c2b077
8 changed files with 58 additions and 5 deletions
|
|
@ -171,6 +171,7 @@ sub getEditForm {
|
|||
#-------------------------------------------------------------------
|
||||
sub getFileUrl {
|
||||
my $self = shift;
|
||||
#return $self->get("url");
|
||||
return $self->getStorageLocation->getUrl($self->get("filename"));
|
||||
}
|
||||
|
||||
|
|
@ -373,6 +374,7 @@ sub www_view {
|
|||
return $self->getContainer->www_view;
|
||||
}
|
||||
$self->session->http->setRedirect($self->getFileUrl);
|
||||
$self->session->http->setStreamedFile($self->getStorageLocation->getPath($self->get("filename")));
|
||||
return '1';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,6 +312,7 @@ sub www_view {
|
|||
}
|
||||
my $storage = $self->getStorageLocation;
|
||||
$self->session->http->setRedirect($storage->getUrl($self->get("filename")));
|
||||
$self->session->http->setStreamedFile($storage->getPath($self->get("filename")));
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ sub view {
|
|||
$var->{'currentPage.url'} = $current->getUrl;
|
||||
$var->{'currentPage.hasChild'} = $current->hasChildren;
|
||||
$var->{'currentPage.rank'} = $current->getRank;
|
||||
$var->{'currentPage.rankIs'.$current->getRank} = 1;
|
||||
my $currentLineage = $current->get("lineage");
|
||||
my $lineageToSkip = "noskip";
|
||||
my $absoluteDepthOfLastPage;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ sub getMimeType {
|
|||
return $self->{_http}{mimetype} || "text/html";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStatus ( ) {
|
||||
|
|
@ -117,6 +116,20 @@ sub getStatus {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStreamedFile ( ) {
|
||||
|
||||
Returns the location of a file to be streamed thru mod_perl, if one has been set.
|
||||
|
||||
=cut
|
||||
|
||||
sub getStreamedFile {
|
||||
my $self = shift;
|
||||
return $self->{_http}{streamlocation} || undef;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isRedirect ( )
|
||||
|
|
@ -377,5 +390,19 @@ sub setStatus {
|
|||
$self->{_http}{statusDescription} = shift;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setStreamedFile ( ) {
|
||||
|
||||
Set a file to be streamed thru mod_perl.
|
||||
|
||||
=cut
|
||||
|
||||
sub setStreamedFile {
|
||||
my $self = shift;
|
||||
$self->{_http}{streamlocation} = shift;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue