14 |
type is 'text', |
type is 'text', |
15 |
label is 'URI', |
label is 'URI', |
16 |
hints is 'Replace search string in URI with %s (grep will be replaced automatically)', |
hints is 'Replace search string in URI with %s (grep will be replaced automatically)', |
17 |
is mandatory, |
is mandatory; |
|
distinct; |
|
18 |
|
|
19 |
column title => |
column title => |
20 |
type is 'text', |
type is 'text', |
26 |
type is 'text', |
type is 'text', |
27 |
label is 'Cookie', |
label is 'Cookie', |
28 |
render as 'textarea', |
render as 'textarea', |
29 |
hints are 'If you leave Cookie data Grep will impersonate you to feed provider!', |
hints is 'If you leave Cookie data Grep will impersonate you to feed provider!', |
30 |
since '0.0.3'; |
since '0.0.3'; |
31 |
|
|
32 |
column owner => |
column owner => |
42 |
filters are 'Jifty::DBI::Filter::DateTime', |
filters are 'Jifty::DBI::Filter::DateTime', |
43 |
since '0.0.5'; |
since '0.0.5'; |
44 |
|
|
45 |
|
column source => |
46 |
|
type is 'text', |
47 |
|
label is 'Source', |
48 |
|
default is 'Grep::Source::Feed', |
49 |
|
# available are defer { Grep::Source::Feed->sources }, |
50 |
|
since '0.0.6'; |
51 |
|
|
52 |
}; |
}; |
53 |
|
|
54 |
sub since { '0.0.1' } |
sub since { '0.0.1' } |
69 |
my $search = shift; |
my $search = shift; |
70 |
|
|
71 |
my $uri = $self->uri or die "no uri?"; |
my $uri = $self->uri or die "no uri?"; |
72 |
|
$uri =~ s/^https:/http:/; |
73 |
$uri =~ s/\Q|!|\E/;/g; |
$uri =~ s/\Q|!|\E/;/g; |
74 |
|
$uri =~ s/{x!(26|3b)}/chr(hex($1))/gei; |
75 |
return sprintf( $uri, $search ); |
return sprintf( $uri, $search ); |
76 |
} |
} |
77 |
|
|
78 |
|
=head2 home_page_uri |
79 |
|
|
80 |
|
print $feed->home_page_uri |
81 |
|
|
82 |
|
Try to strip search arguments from C<uri> and construct home page URI |
83 |
|
|
84 |
|
=cut |
85 |
|
|
86 |
|
sub home_page_uri { |
87 |
|
my $self = shift; |
88 |
|
my $uri = $self->search_uri('foo'); |
89 |
|
$uri =~ s/\?.*$//g; |
90 |
|
return $uri; |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
sub current_user_can { |
sub current_user_can { |
95 |
my $self = shift; |
my $self = shift; |
97 |
|
|
98 |
my $uid = Jifty->web->current_user->id; |
my $uid = Jifty->web->current_user->id; |
99 |
|
|
100 |
|
# superuser |
101 |
|
return 1 if ( defined $uid && $uid == 0 ); |
102 |
|
|
103 |
return 1 if ( $uid && $what eq 'create' ); |
return 1 if ( $uid && $what eq 'create' ); |
104 |
|
|
105 |
return 1 if ( $uid && ! $self->id ); |
return 1 if ( $uid && ! $self->id ); |
106 |
|
|
107 |
Jifty->log->debug("current_user[$uid]_can($what) on Feed ", $self->id || '???', " owner ", $self->owner->id || '???'); |
return 1 if ( $uid && $uid == $self->owner->id ); |
|
|
|
|
return 1 if ( $uid == $self->owner->id ); |
|
108 |
|
|
109 |
|
#warn "$uid can't $what"; |
110 |
} |
} |
111 |
|
|
112 |
1; |
1; |