|
From: Chris W. <la...@us...> - 2001-10-24 20:55:13
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv22563/OpenInteract
Modified Files:
Page.pm
Log Message:
more updates
Index: Page.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/OpenInteract/Page.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Page.pm 2001/10/20 15:11:48 1.1
--- Page.pm 2001/10/24 20:55:11 1.2
***************
*** 59,69 ****
my ( $self ) = @_;
return $self->{content} = ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File->load( $self )
! : OpenInteract::Page::Database->load( $self );
}
########################################
! # RULESET METHODS
########################################
--- 59,69 ----
my ( $self ) = @_;
return $self->{content} = ( $self->{is_file} eq 'yes' )
! ? OpenInteract::Page::File::load( $self )
! : OpenInteract::Page::Database::load( $self );
}
########################################
! # RULES
########################################
***************
*** 73,77 ****
sub ruleset_behavior {
my ( $class, $rs_table ) = @_;
! push @{ $rs_table->{pre_save_action} }, \&find_directory;
return __PACKAGE__;
}
--- 73,79 ----
sub ruleset_behavior {
my ( $class, $rs_table ) = @_;
! push @{ $rs_table->{pre_save_action} }, \&find_directory;
! push @{ $rs_table->{post_save_action} }, \&save_content;
! push @{ $rs_table->{post_remove_action} }, \&remove_content;
return __PACKAGE__;
}
***************
*** 84,87 ****
--- 86,106 ----
}
+
+ sub save_content {
+ my ( $self, $p ) = @_;
+ return 1 unless ( $self->{content} );
+ return ( $self->{is_file} eq 'yes' )
+ ? OpenInteract::Page::File::save( $self )
+ : OpenInteract::Page::Database::save( $self );
+ }
+
+
+ sub remove_content {
+ my ( $self, $p ) = @_;
+ return ( $self->{is_file} eq 'yes' )
+ ? OpenInteract::Page::File::remove( $self )
+ : OpenInteract::Page::Database::remove( $self );
+ }
+
1;
***************
*** 101,105 ****
$page->{location} = '/mysite/home';
$page->{is_file} = 'no';
! $page->{pagetext} = "<h2>Headline</h2><p>This is the text for my page</p>";
$page->{author} = "Scooby Doo";
$page->save;
--- 120,124 ----
$page->{location} = '/mysite/home';
$page->{is_file} = 'no';
! $page->{content} = "<h2>Headline</h2><p>This is the text for my page</p>";
$page->{author} = "Scooby Doo";
$page->save;
***************
*** 116,120 ****
=head1 DESCRIPTION
! This class adds methods to the SPOPS class that represents static pages.
=head1 METHODS
--- 135,141 ----
=head1 DESCRIPTION
! This class adds methods to the SPOPS class that represents static
! pages. Depending on a property in the object, it will save the content
! to the filesystem or in the database.
=head1 METHODS
***************
*** 129,132 ****
--- 150,159 ----
directory.
+ B<content()>
+
+ Retrieve content for this page. Note that we do not make this a
+ B<post_fetch_action> since there are likely times when you want to
+ just deal with the page metadata, not the content.
+
B<object_description()>
***************
*** 140,144 ****
B<pre_save_action>
! Set the C<directory> property from the C<location> property
=head1 BUGS
--- 167,179 ----
B<pre_save_action>
! Set the C<directory> property from the C<location> property.
!
! B<post_save_action>
!
! If there is content, save it to either the db or filesystem.
!
! B<post_remove_action>
!
! Remove content from either the database or filesystem.
=head1 BUGS
|