site/cgi-bin/modules/BSE/AdminUsers.pm
site/cgi-bin/modules/BSE/API.pm
site/cgi-bin/modules/BSE/Arrows.pm
+site/cgi-bin/modules/BSE/ArticleMetaMeta.pm
site/cgi-bin/modules/BSE/Cache.pm
site/cgi-bin/modules/BSE/Cache/Cache.pm
site/cgi-bin/modules/BSE/Cache/CHI.pm
--- /dev/null
+package BSE::ArticleMetaMeta;
+use strict;
+use base 'BSE::MetaMeta';
+
+our $VERSION = "1.000";
+
+sub validation_section {
+ "article metadata validation";
+}
+
+sub fields_section {
+ "global article metadata";
+}
+
+sub name_section {
+ my ($self, $name) = @_;
+
+ return "article metadata $name";
+}
+
+1;
use constant MAX_FILE_DISPLAYNAME_LENGTH => 255;
use constant ARTICLE_CUSTOM_FIELDS_CFG => "article custom fields";
-our $VERSION = "1.051";
+our $VERSION = "1.052";
=head1 NAME
$errors{template} = "Please only select templates from the list provided";
}
+ my $meta;
+ if ($cgi->param("_save_meta")) {
+ require BSE::ArticleMetaMeta;
+ $meta = BSE::ArticleMetaMeta->retrieve($req, $article, \%errors);
+ }
+
my $save_tags = $cgi->param("_save_tags");
my @tags;
if ($save_tags) {
$article->set_tags([ grep /\S/, @tags ], \$error);
}
+use Data::Dumper;
+print STDERR Dumper($meta);
+ if ($meta) {
+ BSE::ArticleMetaMeta->save($article, $meta);
+ }
+
# fix the kids too
my @extra_regen;
@extra_regen = $self->update_child_dynamic($article, $articles, $req);
use Image::Size;
use Fcntl ':seek';
-our $VERSION = "1.004";
+our $VERSION = "1.005";
=head1 NAME
return $fields{$self->name};
}
-=item name
+=item validate
-The field name of the metadata.
+Validate a meta data item.
=cut
return 1;
}
-=item name
+=item metanames
-The field name of the metadata.
+List of form fields that are read for the meta item.
=cut
$_[0]{display_name}
}
+=back
+
=head1 CLASS METHODS
=over
use strict;
use Carp 'confess';
-our $VERSION = "1.002";
+our $VERSION = "1.003";
=head1 NAME
);
}
-=item metadata
+=item text_metadata
Return all metadata for the object with a content type of
C<text/plain>.
These are not accessible from templates.
+=over
+
=item clear_metadata
Remove all metadata for this object. Should be called when the object
use BSE::TB::SiteCommon;
use BSE::TB::TagOwner;
use BSE::FormatterBase;
+use BSE::MetaOwnerBase;
use vars qw/@ISA/;
-@ISA = qw/Squirrel::Row BSE::TB::SiteCommon BSE::TB::TagOwner BSE::FormatterBase/;
+@ISA = qw/Squirrel::Row BSE::TB::SiteCommon BSE::TB::TagOwner BSE::FormatterBase BSE::MetaOwnerBase/;
+
use Carp 'confess';
-our $VERSION = "1.028";
+our $VERSION = "1.029";
=head1 NAME
return grep $_->should_index, @kids, map($_->others_indexed_as_myself, @kids);
}
+sub meta_owner_type {
+ 'bse_article';
+}
+
+sub meta_meta_cfg_section {
+ "global article metadata";
+}
+
+sub meta_meta_cfg_prefix {
+ "article metadata";
+}
+
+sub metafields {
+ my ($self, $cfg) = @_;
+
+ $cfg ||= BSE::Cfg->single;
+
+ my %metanames = map { $_ => 1 } $self->metanames;
+
+ require BSE::ArticleMetaMeta;
+ my @fields = grep $metanames{$_->name} || $_->cond($self), BSE::ArticleMetaMeta->all_metametadata($cfg);
+
+ return ( @fields );
+}
+
+
sub restricted_method {
my ($self, $name) = @_;
</tr>
<:or Article:><:eif Article:>
</table>
+<:.if !ifnew -:>
+<:.set metas = [ article.metafields ] -:>
+<: .if metas.size -:>
+<fieldset>
+ <legend>Article Metadata</legend>
+<input type="hidden" name="_save_meta" value="1">
+<: .for m in metas -:>
+<:#= bse.dumper(m) |raw :>
+<: .set name = "meta_" _ m.name -:>
+<: .set mdata = article.meta_by_name(m.name) -:>
+<: .if m.type eq 'image' -:>
+<: .set def = article.meta_by_name(m.display_name) -:>
+<: .set def = def ? def.value_text : "" -:>
+<: .else -:>
+<: .set def = mdata ? mdata.value_text : "" -:>
+<: .end if -:>
+<: .if m.ro -:>
+<: .call "inlinefieldro", name: name, field: m.field,
+ options: { default: def } -:>
+<: .else -:>
+<: .call "inlinefield", name: name, field: m.field,
+ options: { delete: 1, default: def } -:>
+<: .end if :>
+<: .end for -:>
+</fieldset>
+<: .end if -:>
+<:.end if -:>
<p><: ifNew :>
<input type="submit" name="save" value="Add New <: articleType:>" />
<legend>File metadata</legend>
<: .for m in metas -:>
-<:= bse.dumper(m.field) |raw :>
<:#= bse.dumper(m) |raw :>
<: .set name = "meta_" _ m.name -:>
<: .set mdata = file.meta_by_name(m.name) -:>