From: Chris W. <la...@us...> - 2005-09-21 03:34:49
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/base_page/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3903/OpenInteract2/Action Modified Files: Page.pm Log Message: make page wrapper configurable; if 'main_template' is configured in displayable page, communicate that info up to the controller Index: Page.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/base_page/OpenInteract2/Action/Page.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Page.pm 18 Mar 2005 04:09:44 -0000 1.27 --- Page.pm 21 Sep 2005 03:34:40 -0000 1.28 *************** *** 30,33 **** --- 30,35 ---- # etc.) get sent to the user directly + use constant DEFAULT_WRAPPER => 'base_page::page_displayable'; + my %DISPLAY_TYPES = map { $_ => 1 } ( 'text/html', 'text/plain' ); *************** *** 773,776 **** --- 775,799 ---- } + # If we've defined a 'main_template' then we'll assign it to the + # controller, add any boxes ourselves and not parse content + if ( my $main_template = $page->main_template ) { + eval { + my $ctl = CTX->controller; + if ( $main_template eq 'base_raw' ) { #compatibility... + $ctl->no_template( 'yes' ); + } + else { + $ctl->main_template( $main_template ); + } + $ctl->add_box( $_ ) for ( @box_add ); + $ctl->remove_box( $_ ) for ( @box_remove ); + }; + return ( ref $page->{content} ) + ? ${ $page->{content} } + : $page->{content}; + } + + + my %params = ( box_add => \@box_add, *************** *** 788,793 **** } $params{content} = $base_display_content; return $self->generate_content( ! \%params, { name => 'base_page::page_displayable' }); } --- 811,818 ---- } $params{content} = $base_display_content; + my $wrapper_template = $self->param( 'wrapper_template' ) + || DEFAULT_WRAPPER; return $self->generate_content( ! \%params, { name => $wrapper_template }); } |