|
From: Chris W. <la...@us...> - 2001-11-06 15:03:11
|
Update of /cvsroot/openinteract/OpenInteract/pkg/classified/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv26216/pkg/classified/OpenInteract/Handler
Modified Files:
Classified.pm
Log Message:
date and other updates
Index: Classified.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/classified/OpenInteract/Handler/Classified.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Classified.pm 2001/10/14 23:19:33 1.8
--- Classified.pm 2001/11/06 15:03:09 1.9
***************
*** 4,7 ****
--- 4,8 ----
use strict;
+ use Class::Date qw();
use Data::Dumper qw( Dumper );
use OpenInteract::CommonHandler;
***************
*** 17,25 ****
%OpenInteract::Handler::Classified::security = (
DEFAULT_SECURITY_KEY() => SEC_LEVEL_NONE,
! edit => SEC_LEVEL_READ,
remove => SEC_LEVEL_WRITE,
);
! use constant DEFAULT_EXPIRE => 60 * 60 * 24 * 7 * 12; # 12 weeks
sub MY_PACKAGE { return 'classified' }
--- 18,26 ----
%OpenInteract::Handler::Classified::security = (
DEFAULT_SECURITY_KEY() => SEC_LEVEL_NONE,
! create => SEC_LEVEL_READ, edit => SEC_LEVEL_READ,
remove => SEC_LEVEL_WRITE,
);
! use constant DEFAULT_EXPIRE => '+84D';
sub MY_PACKAGE { return 'classified' }
***************
*** 32,35 ****
--- 33,37 ----
sub MY_SEARCH_RESULTS_TITLE { return 'Classified Search Results' }
sub MY_SEARCH_RESULTS_TEMPLATE { return 'classified_search_results' }
+ sub MY_OBJECT_CREATE_SECURITY { return SEC_LEVEL_READ }
sub MY_OBJECT_FORM_TITLE { return 'Classified Detail' }
***************
*** 50,53 ****
--- 52,56 ----
sub MY_ALLOW_SEARCH_FORM { return 1 }
sub MY_ALLOW_SEARCH { return 1 }
+ sub MY_ALLOW_CREATE { return 1 }
sub MY_ALLOW_SHOW { return 1 }
sub MY_ALLOW_EDIT { return 1 }
***************
*** 71,93 ****
}
! my $post_after = $class->_read_field_date( $apr, 'posted_after' );
if ( $post_after ) {
push @{ $where }, 'posted_on >= ?';
! push @{ $value }, $post_after;
}
}
-
- # We present dates to the user in three separate fields
-
- sub _read_field_date {
- my ( $class, $apr, $field ) = @_;
- return join( '-', $apr->param( $field . '_year' ),
- $apr->param( $field . '_month' ),
- $apr->param( $field . '_day' ) );
- }
-
-
# If the user has WRITE access to the object, then he/she is an admin
# and can set active, expires_on and active_on
--- 74,85 ----
}
! my $post_after = $class->_read_field_date_object( $apr, 'posted_after' );
if ( $post_after ) {
push @{ $where }, 'posted_on >= ?';
! push @{ $value }, $post_after->strftime( '%Y-%m-%d' );
}
}
# If the user has WRITE access to the object, then he/she is an admin
# and can set active, expires_on and active_on
***************
*** 119,123 ****
my $site_admin_id = $R->CONFIG->{default_objects}{site_admin_group};
foreach my $group ( @{ $R->{auth}{group} } ) {
! $is_admin++ if ( $group->id == $site_admin_id );
}
--- 111,115 ----
my $site_admin_id = $R->CONFIG->{default_objects}{site_admin_group};
foreach my $group ( @{ $R->{auth}{group} } ) {
! $is_admin++ if ( $group->id == $site_admin_id );
}
***************
*** 127,133 ****
$classified->{active_on} ||= $now;
unless ( $classified->{expires_on} ) {
! my $expire_time = $R->{time} + DEFAULT_EXPIRE;
! my @t = localtime( $expire_time );
! $classified->{expires_on} = join '-', $t[5] + 1900, $t[4] + 1, $t[3];
}
}
--- 119,124 ----
$classified->{active_on} ||= $now;
unless ( $classified->{expires_on} ) {
! my $expire_date = Class::Date->new( $R->{time} ) + DEFAULT_EXPIRE;
! $classified->{expires_on} = $expire_date->strftime( '%Y-%m-%d' );;
}
}
|