/[Grep]/lib/Grep/Model/Item.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Grep/Model/Item.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 128 by dpavlin, Sun Apr 29 00:48:04 2007 UTC revision 168 by dpavlin, Wed Jul 4 09:38:51 2007 UTC
# Line 33  use Grep::Record schema { Line 33  use Grep::Record schema {
33          column author =>          column author =>
34                  type is 'text';                  type is 'text';
35    
36          column issued =>          column created_on =>
37                  type is 'timestamp',                  type is 'timestamp',
38                    default is defer { DateTime->now },
39                  filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime );                  filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime );
40    
41          column modified =>          column last_update =>
42                  type is 'timestamp',                  type is 'timestamp',
43                  filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime );                  filters are qw( Jifty::Filter::DateTime Jifty::DBI::Filter::DateTime );
44    
# Line 53  sub current_user_can { Line 54  sub current_user_can {
54    
55          my $uid = Jifty->web->current_user->id;          my $uid = Jifty->web->current_user->id;
56    
57            # superuser
58            return 1 if ( defined $uid && $uid == 0 );
59    
60          return 1 if ( $uid && $what eq 'create' );          return 1 if ( $uid && $what eq 'create' );
61    
62          return 1 if ( $uid && ! $self->id );          return 1 if ( $uid && ! $self->id );
# Line 69  sub current_user_can { Line 73  sub current_user_can {
73          warn "$uid can't $what";          warn "$uid can't $what";
74  }  }
75    
76  =for TODO  sub _set {
77            my $self = shift;
78  sub after_create {          my ($val, $msg) = $self->SUPER::_set(@_);
         my $self                    = shift;  
         my $insert_return_value_ref = shift;  
   
         return unless $$insert_return_value_ref;    # bail if insert failed  
         $self->load($$insert_return_value_ref);     # load ourselves from db  
   
         # Do whatever needs to be done here  
79    
80  #       use Data::Dump qw/dump/;          $self->SUPER::_set(column => 'last_update', value => defer { DateTime->now });
 #       warn "after_create ", dump( $self->as_hash );  
81    
82          return; # return value is ignored          return ($val, $msg);
83  }  }
84    
 =cut  
   
85  1;  1;
86    

Legend:
Removed from v.128  
changed lines
  Added in v.168

  ViewVC Help
Powered by ViewVC 1.1.26