|
From: Chris W. <la...@us...> - 2001-10-12 16:04:17
|
Update of /cvsroot/openinteract/OpenInteract/pkg/static_page/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv22538/pkg/static_page/OpenInteract/Handler
Modified Files:
BasicPage.pm
Log Message:
enable static pages to have
<template_status>no_parse</template_status> in them so we know not to
parse them with TT (Thanks to Reinier Post <rp...@wi...> for
reporting the original error which led to this fix.)
Index: BasicPage.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/static_page/OpenInteract/Handler/BasicPage.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** BasicPage.pm 2001/08/22 04:21:19 1.14
--- BasicPage.pm 2001/10/12 16:04:14 1.15
***************
*** 22,26 ****
! use constant MAIN_SCRIPT => '/BasicPage';
# Use this to mark the beginning and end of the "good" content in a
--- 22,27 ----
! use constant MAIN_SCRIPT => '/BasicPage';
! use constant NO_PARSE_STATUS => 'no_parse';
# Use this to mark the beginning and end of the "good" content in a
***************
*** 49,54 ****
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! return 'show' if ( $R->{path}->{full}->[0] ne 'BasicPage' );
! return lc shift @{ $R->{path}->{current} }
|| $OpenInteract::Handler::BasicPage::default_method;
}
--- 50,55 ----
my ( $class ) = @_;
my $R = OpenInteract::Request->instance;
! return 'show' if ( $R->{path}{full}->[0] ne 'BasicPage' );
! return lc shift @{ $R->{path}{current} }
|| $OpenInteract::Handler::BasicPage::default_method;
}
***************
*** 84,88 ****
}
! $R->{page}->{title} = 'Listing of Documents';
return $R->template->handler( {}, $params,
{ db => 'static_dir_listing',
--- 85,89 ----
}
! $R->{page}{title} = 'Listing of Documents';
return $R->template->handler( {}, $params,
{ db => 'static_dir_listing',
***************
*** 108,114 ****
my $location = $p->{location} ||
$R->apache->param( 'location' ) ||
! $R->{path}->{original};
! my $storage = $R->CONFIG->{action}->{basicpage}->{storage};
my ( $page_info );
--- 109,115 ----
my $location = $p->{location} ||
$R->apache->param( 'location' ) ||
! $R->{path}{original};
! my $storage = $R->CONFIG->{action}{basicpage}{storage};
my ( $page_info );
***************
*** 151,155 ****
# content will be plain old HTML...
! $R->{page}->{content_type} = 'text/html';
if ( $error_type =~ /^security/ ) {
--- 152,156 ----
# content will be plain old HTML...
! $R->{page}{content_type} = 'text/html';
if ( $error_type =~ /^security/ ) {
***************
*** 172,176 ****
if ( $page_info->{send_file} ) {
! $R->{page}->{send_file} = $page_info->{send_file};
$R->DEBUG && $R->scrib( 1, "File being retrieved is not displayable. Set 'send_file' to $page_info->{send_file}" );
return undef;
--- 173,177 ----
if ( $page_info->{send_file} ) {
! $R->{page}{send_file} = $page_info->{send_file};
$R->DEBUG && $R->scrib( 1, "File being retrieved is not displayable. Set 'send_file' to $page_info->{send_file}" );
return undef;
***************
*** 187,194 ****
if ( $do_edit ) {
$page ||= $R->static_page->new;
! $params->{static_page} = $page;
$text_params = { db => 'static_page_form',
package => 'static_page' };
! $R->{page}->{title} = 'Edit a Document';
my $update_items = eval { $page->fetch_updates( 5 ) } || [];
foreach my $update_info ( @{ $update_items } ) {
--- 188,195 ----
if ( $do_edit ) {
$page ||= $R->static_page->new;
! $params->{static_page} = $page;
$text_params = { db => 'static_page_form',
package => 'static_page' };
! $R->{page}{title} = 'Edit a Document';
my $update_items = eval { $page->fetch_updates( 5 ) } || [];
foreach my $update_info ( @{ $update_items } ) {
***************
*** 204,214 ****
unless ( my $is_active = $class->_check_active_date( $page_info ) ) {
$R->DEBUG && $R->scrib( 1, "Page has been marked as non-active ($is_active); returning error message." );
! $R->{page}->{title} = 'Page not yet active';
return '<h2 align="center">Not Active</h2>' .
'<p>Sorry, this page is not yet active.</p>';
}
! $R->{page}->{title} = $page_info->{title};
! $R->{page}->{script} .= $page_info->{script};
# Allows the page to define the main template it will use; if
--- 205,215 ----
unless ( my $is_active = $class->_check_active_date( $page_info ) ) {
$R->DEBUG && $R->scrib( 1, "Page has been marked as non-active ($is_active); returning error message." );
! $R->{page}{title} = 'Page not yet active';
return '<h2 align="center">Not Active</h2>' .
'<p>Sorry, this page is not yet active.</p>';
}
! $R->{page}{title} = $page_info->{title};
! $R->{page}{script} .= $page_info->{script};
# Allows the page to define the main template it will use; if
***************
*** 216,220 ****
# the default
! $R->{page}->{_template_name_} = $page_info->{main_template};
# You can split your page into multiple viewable pages -- see
--- 217,221 ----
# the default
! $R->{page}{_template_name_} = $page_info->{main_template};
# You can split your page into multiple viewable pages -- see
***************
*** 227,230 ****
--- 228,239 ----
}
}
+
+ # If the page has told us not to run it through TT, just return
+ # its content.
+
+ if ( $page_info->{_template_status} eq NO_PARSE_STATUS ) {
+ return $page_info->{pagetext};
+ }
+
return $R->template->handler( {}, $params, $text_params );
}
***************
*** 236,240 ****
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
! $R->{page}->{return_url} = '/BasicPage/listing/';
my $apr = $R->apache;
--- 245,249 ----
my ( $class, $p ) = @_;
my $R = OpenInteract::Request->instance;
! $R->{page}{return_url} = '/BasicPage/listing/';
my $apr = $R->apache;
***************
*** 345,349 ****
$location = $class->_remove_query_string( $location );
$location = lc $location;
! my $home_name = $R->CONFIG->{action}->{basicpage}->{object_home_name};
my @locations = ( $location );
--- 354,358 ----
$location = $class->_remove_query_string( $location );
$location = lc $location;
! my $home_name = $R->CONFIG->{action}{basicpage}{object_home_name};
my @locations = ( $location );
***************
*** 398,402 ****
$R->DEBUG && $R->scrib( 1, "Trying to retrieve FILE with location ($location)" );
$location = $class->_remove_query_string( $location );
! my $home_name = $R->CONFIG->{action}->{basicpage}->{filesystem_home_name};
if ( $location =~ m|/$| ) {
--- 407,411 ----
$R->DEBUG && $R->scrib( 1, "Trying to retrieve FILE with location ($location)" );
$location = $class->_remove_query_string( $location );
! my $home_name = $R->CONFIG->{action}{basicpage}{filesystem_home_name};
if ( $location =~ m|/$| ) {
***************
*** 421,425 ****
my $html_dir = $R->CONFIG->get_dir( 'html' );
$html_dir =~ s|/$||;
!
foreach my $location ( @loc ) {
--- 430,434 ----
my $html_dir = $R->CONFIG->get_dir( 'html' );
$html_dir =~ s|/$||;
!
foreach my $location ( @loc ) {
***************
*** 450,455 ****
security_object_class => $R->security_object,
object_id => $location,
! user => $R->{auth}->{user},
! group => $R->{auth}->{group},
hierarchy_separator => '/' }) };
$R->scrib( 0, "Error found checking security: $@" ) if ( $@ );
--- 459,464 ----
security_object_class => $R->security_object,
object_id => $location,
! user => $R->{auth}{user},
! group => $R->{auth}{group},
hierarchy_separator => '/' }) };
$R->scrib( 0, "Error found checking security: $@" ) if ( $@ );
***************
*** 493,496 ****
--- 502,508 ----
if ( $page_info->{pagetext} =~ s|<boxes>(.*)?</boxes>|| ) {
$page_info->{boxes} = $1;
+ }
+ if ( $page_info->{pagetext} =~ m|<template_status>(.*)?</template_status>| ) {
+ $page_info->{_template_status} = $1;
}
|