|
From: Chris W. <la...@us...> - 2001-10-20 15:17:46
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv13658/OpenInteract
Modified Files:
SPOPS.pm
Log Message:
remove html_* methods; cosmetic
Index: SPOPS.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/SPOPS.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SPOPS.pm 2001/10/17 04:47:07 1.14
--- SPOPS.pm 2001/10/20 15:17:44 1.15
***************
*** 31,35 ****
# Don't create an object key if we're explicitly told not to
! return 1 if ( $self->CONFIG->{skip_object_key} );
$p ||= {};
--- 31,35 ----
# Don't create an object key if we're explicitly told not to
! return 1 if ( $self->CONFIG->{skip_object_key} || $p->{skip_object_key} );
$p ||= {};
***************
*** 66,70 ****
my ( $self, $p ) = @_;
$p ||= {};
! my $row = $self->db_select({ %{ $p },
from => OBJECT_KEY_TABLE,
select => [ 'object_key' ],
--- 66,70 ----
my ( $self, $p ) = @_;
$p ||= {};
! my $row = $self->db_select({ %{ $p },
from => OBJECT_KEY_TABLE,
select => [ 'object_key' ],
***************
*** 84,88 ****
$p->{db} ||= $class->global_db_handle;
die "Cannot retrieve object info without key!" unless ( $key );
! my $row = SPOPS::SQLInterface->db_select({ %{ $p },
from => OBJECT_KEY_TABLE,
select => [ 'class', 'object_id' ],
--- 84,88 ----
$p->{db} ||= $class->global_db_handle;
die "Cannot retrieve object info without key!" unless ( $key );
! my $row = SPOPS::SQLInterface->db_select({ %{ $p },
from => OBJECT_KEY_TABLE,
select => [ 'class', 'object_id' ],
***************
*** 114,123 ****
sub log_action {
my ( $self, $action, $id ) = @_;
! return 1 unless ( $self->CONFIG->{track}->{ $action } );
return $self->log_action_enter( $action, $id );
}
! # Log the object, the action (create, update, remove), who did
# the action and when it was done.
#
--- 114,123 ----
sub log_action {
my ( $self, $action, $id ) = @_;
! return 1 unless ( $self->CONFIG->{track}{ $action } );
return $self->log_action_enter( $action, $id );
}
! # Log the object, the action (create, update, remove), who did
# the action and when it was done.
#
***************
*** 127,142 ****
my ( $self, $action, $id, $uid ) = @_;
my $R = OpenInteract::Request->instance;
! $uid ||= ( ref $R->{auth}->{user} ) ? $R->{auth}->{user}->{user_id} : 0;
my $now = SPOPS::Utility->now;
my $class = ref $self || $self;
my $log_msg = $R->apache->param( '_log_message' );
$R->DEBUG && $R->scrib( 1, "Entering action $action to $class ($id) by $uid on $now" );
! eval { $self->db_insert({ db => $R->db,
! table => 'object_track',
field => [ qw/ class object_id action action_by action_on notes / ],
value => [ $class, $id, $action, $uid, $now, $log_msg ] } ); };
if ( $@ ) {
$R->scrib( 0, "Log entry failed: $SPOPS::Error::system_msg" );
! OpenInteract::Error->set( SPOPS::Error->get );
$OpenInteract::Error::user_msg = "Cannot log object action: $action";
$OpenInteract::Error::notes = "Object: $class ($id) by $uid on $now";
--- 127,142 ----
my ( $self, $action, $id, $uid ) = @_;
my $R = OpenInteract::Request->instance;
! $uid ||= ( ref $R->{auth}{user} ) ? $R->{auth}{user}{user_id} : 0;
my $now = SPOPS::Utility->now;
my $class = ref $self || $self;
my $log_msg = $R->apache->param( '_log_message' );
$R->DEBUG && $R->scrib( 1, "Entering action $action to $class ($id) by $uid on $now" );
! eval { $self->db_insert({ db => $R->db,
! table => 'object_track',
field => [ qw/ class object_id action action_by action_on notes / ],
value => [ $class, $id, $action, $uid, $now, $log_msg ] } ); };
if ( $@ ) {
$R->scrib( 0, "Log entry failed: $SPOPS::Error::system_msg" );
! OpenInteract::Error->set( SPOPS::Error->get );
$OpenInteract::Error::user_msg = "Cannot log object action: $action";
$OpenInteract::Error::notes = "Object: $class ($id) by $uid on $now";
***************
*** 157,162 ****
return undef unless ( ref $self and $self->id );
my $R = OpenInteract::Request->instance;
! my $data = eval { $self->db_select({
! db => $R->db,
select => [ 'action_by' ],
from => [ 'object_track' ],
--- 157,162 ----
return undef unless ( ref $self and $self->id );
my $R = OpenInteract::Request->instance;
! my $data = eval { $self->db_select({
! db => $R->db,
select => [ 'action_by' ],
from => [ 'object_track' ],
***************
*** 166,170 ****
if ( $@ ) {
$OpenInteract::Error::user_msg = 'Cannot retrieve object creator(s)';
! $OpenInteract::Error::extra = { class => ref $self,
object_id => $self->id };
$R->throw( { code => 306 } );
--- 166,170 ----
if ( $@ ) {
$OpenInteract::Error::user_msg = 'Cannot retrieve object creator(s)';
! $OpenInteract::Error::extra = { class => ref $self,
object_id => $self->id };
$R->throw( { code => 306 } );
***************
*** 182,191 ****
my ( $self, $uid ) = @_;
my $R = OpenInteract::Request->instance;
! $uid ||= $R->{auth}->{user}->{user_id};
return undef unless ( $uid );
# the great and powerful superuser sees all
! return 1 if ( $uid eq $R->CONFIG->{default_objects}->{superuser} );
my $creator_list = eval { $self->fetch_creator } || [];
--- 182,191 ----
my ( $self, $uid ) = @_;
my $R = OpenInteract::Request->instance;
! $uid ||= $R->{auth}{user}{user_id};
return undef unless ( $uid );
# the great and powerful superuser sees all
! return 1 if ( $uid eq $R->CONFIG->{default_objects}{superuser} );
my $creator_list = eval { $self->fetch_creator } || [];
***************
*** 197,202 ****
! # Retrieve an arrayref of arrayrefs where item 0 is the uid
! # of the user who last did the update and item 1 is the
# date of the update
--- 197,202 ----
! # Retrieve an arrayref of arrayrefs where item 0 is the uid
! # of the user who last did the update and item 1 is the
# date of the update
***************
*** 218,222 ****
if ( $@ ) {
$OpenInteract::Error::user_msg = 'Cannot retrieve object updates';
! $OpenInteract::Error::extra = { class => ref $self,
object_id => $self->id };
$R->throw( { code => 306 } );
--- 218,222 ----
if ( $@ ) {
$OpenInteract::Error::user_msg = 'Cannot retrieve object updates';
! $OpenInteract::Error::extra = { class => ref $self,
object_id => $self->id };
$R->throw( { code => 306 } );
***************
*** 259,286 ****
sub global_user_class { return OpenInteract::Request->user }
sub global_group_class { return OpenInteract::Request->group }
! sub global_user_current { return OpenInteract::Request->instance->{auth}->{user} }
! sub global_group_current { return OpenInteract::Request->instance->{auth}->{group} }
!
!
! ########################################
! # HTML ENCODE/DECODE (keep?)
! ########################################
!
! # Use this to translate from
! # <font size="-1"...
! # to
! # <font size="-1"...
! # Params: 0: class; 1: text
!
! sub html_encode { return HTML::Entities::encode( $_[1] ); }
!
!
! # Use this to translate from
! # <font size="-1"...
! # to
! # <font size="-1"...
! # Params: 0: class; 1: text
!
! sub html_decode { return HTML::Entities::decode( $_[1] ); }
--- 259,264 ----
sub global_user_class { return OpenInteract::Request->user }
sub global_group_class { return OpenInteract::Request->group }
! sub global_user_current { return OpenInteract::Request->instance->{auth}{user} }
! sub global_group_current { return OpenInteract::Request->instance->{auth}{group} }
***************
*** 297,306 ****
$p->{object} ||= [];
! # If we weren't given any objects and we were called by
# a class instead of an object
return undef unless ( ref $item or scalar @{ $p->{object} } );
! # If we were just called by an object, make it our message
push @{ $p->{object} }, $item unless ( scalar @{ $p->{object} } );
--- 275,284 ----
$p->{object} ||= [];
! # If we weren't given any objects and we were called by
# a class instead of an object
return undef unless ( ref $item or scalar @{ $p->{object} } );
! # If we were just called by an object, make it our message
push @{ $p->{object} }, $item unless ( scalar @{ $p->{object} } );
***************
*** 317,321 ****
"\n$separator\nEnd $p->{type} object\n\n\n";
}
! eval { OpenInteract::Utility->send_email({
to => $p->{email},
from => $R->CONFIG->{mail}{admin_email} || $R->CONFIG->{admin_email},
--- 295,299 ----
"\n$separator\nEnd $p->{type} object\n\n\n";
}
! eval { OpenInteract::Utility->send_email({
to => $p->{email},
from => $R->CONFIG->{mail}{admin_email} || $R->CONFIG->{admin_email},
***************
*** 392,396 ****
Makes an entry into the 'object_track' table, which logs all object
creations, updates and deletions. We do not note the content that
! changes, but we do note who did the action and when it was done.
Parameters:
--- 370,374 ----
Makes an entry into the 'object_track' table, which logs all object
creations, updates and deletions. We do not note the content that
! changes, but we do note who did the action and when it was done.
Parameters:
***************
*** 496,538 ****
information in your class configuration which specifies the fields you
want to use in the listing along with associated labels.
-
- B<html_encode( $text )>
-
- Parameters:
-
- =over 4
-
- =item *
-
- B<text> ($)
-
- Text to encode.
-
- =back
-
- B<Returns>: escaped version of $text (e.g., the character '"' will be
- replaced by ")
-
- B<html_decode( $text )>
-
- Parameters:
-
- =over 4
-
- =item *
-
- B<text> ($)
-
- Text to decode.
-
- =back
-
- Returns: unescaped version of $text (e.g., the entity " will be
- replaced by the character '"')
-
- It may seem silly to have these html_ methods which currently just
- call the method of an external module, but we might wish to do more in
- the future (for example, screen out javascript>. This way, we have a
- central place to change it.
=head1 TO DO
--- 474,477 ----
|