/[A3C]/lib/A3C/Model/StrixInstanceSelection.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

Contents of /lib/A3C/Model/StrixInstanceSelection.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 157 - (show annotations)
Sun Jun 15 10:51:57 2008 UTC (15 years, 10 months ago) by dpavlin
Original Path: lib/A3C/Model/StrixSiteSelection.pm
File size: 985 byte(s)
create kind of copy/paste buffer which enables you to select some strix sites
and perform operations on them together (no ops implemented in this commit)
1 use strict;
2 use warnings;
3
4 package A3C::Model::StrixSiteSelection;
5 use Jifty::DBI::Schema;
6
7 use Data::Dump qw/dump/;
8
9 use A3C::Record schema {
10
11 column strix =>
12 label is _('Site identifier'),
13 is mandatory,
14 type is 'text',
15 refers_to A3C::Model::StrixSite by 'site';
16
17 column by_user =>
18 label is ('Selected by user'),
19 is mandatory,
20 refers_to A3C::Model::User by 'id',
21 default is defer { Jifty->web->current_user->id };
22
23 };
24
25 # Your model-specific methods go here.
26
27 sub since { '0.0.4' };
28
29 sub validate_strix {
30 my $self = shift;
31 my $site = shift;
32
33 my $strix = A3C::Model::StrixSiteSelection->new;
34 $strix->load_by_cols( strix => $site );
35
36 return ( 0, _('Site %1 is allready selected', $site) ) if $strix->id;
37 return 1;
38 }
39
40 sub current_user_can {
41 my $self = shift;
42 # warn " current_user->id: ", $self->current_user->id, " == ", dump( $self->by_user->id );
43 # FIXME just my sites
44 #return 1 if $self->by_user->id == $self->current_user->id;
45 return 1;
46 return 0;
47 }
48
49 1;
50

  ViewVC Help
Powered by ViewVC 1.1.26