optional case-insensitivity for searching
[bse.git] / site / cgi-bin / modules / BSE / TB / MetaEntry.pm
CommitLineData
f5b7b326 1package BSE::TB::MetaEntry;
6430ee52
TC
2use strict;
3use base 'Squirrel::Row';
4
c29434c9 5our $VERSION = "1.002";
cb7fd78d 6
6430ee52
TC
7sub table {
8 "bse_article_file_meta";
9}
10
11sub columns {
f5b7b326 12 qw/id file_id name content_type value appdata owner_type/;
6430ee52
TC
13}
14
15sub defaults {
16 content_type => "text/plain",
c840f7f9 17 appdata => 1,
6430ee52
TC
18}
19
36e373a9
TC
20sub is_text {
21 $_[0]->content_type eq "text/plain"
22}
23
c29434c9
TC
24sub is_text_type {
25 $_[0]->content_type =~ m(^text/);
26}
27
28sub value_text {
29 my ($self) = @_;
30
31 $self->is_text_type or return;
32
33 my $value = $self->value;
34 utf8::decode($value) or return;
35
36 return $value;
37}
38
39sub set_value_text {
40 my ($self, $value) = @_;
41
42 $self->is_text_type or return;
43
44 utf8::encode($value);
45
46 $self->set_value($value);
47
48 1;
49}
50
6430ee52 511;