-VERSION=0.15_23
+VERSION=0.15_24
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
-- user must be logged in to download this file
requireUser integer not null default 0,
+ -- more descriptive stuff
+ notes text not null default '',
+
primary key (id)
);
my $generator = $article->{generator}
->new(admin=>$admin, articles=>$articles, cfg=>$cfg, request=>$req,
top=>$article);
-
- print "Content-Type: text/html\n\n";
- print $generator->generate($article, $articles);
+
+ if ($article->is_dynamic) {
+ my $content = $generator->generate($article, $articles);
+ (my $dyn_gen_class = $article->{generator}) =~ s/.*\W//;
+ $dyn_gen_class = "BSE::Dynamic::".$dyn_gen_class;
+ (my $dyn_gen_file = $dyn_gen_class . ".pm") =~ s!::!/!g;
+ require $dyn_gen_file;
+ my $dyn_gen = $dyn_gen_class->new($req);
+ $article = $dyn_gen->get_real_article($article);
+ my $result = $dyn_gen->generate($article, $content);
+ BSE::Template->output_result($req, $result);
+ }
+ else {
+ print "Content-Type: text/html\n\n";
+ print $generator->generate($article, $articles);
+ }
}
else {
# display a message on the admin menu
keyword=>4,
pageTitle=>5,
author=>4,
-# file_excerpt=>2,
+ file_displayName => 2,
file_description=>2,
+ file_notes => 1,
);
for my $name (keys %scores) {
@dont_search{@SEARCH_EXCLUDE} = @SEARCH_EXCLUDE;
@do_search{@SEARCH_INCLUDE} = @SEARCH_INCLUDE;
INDEX: until ($articles->EOF) {
+ my @files;
+ my $got_files;
# find the section
my $article = $articles->getNext;
next unless ($article->{listed} || $article->{flags} =~ /I/);
$text = $article->{$field};
}
else {
- if ($field eq 'file_description') {
- my @files = $article->files;
- $text = join "\n", map { @$_{qw/displayName description/} } @files;
+ if ($field =~ /^file_(.*)/) {
+ my $file_field = $1;
+ @files = $article->files unless $got_files++;
+ $text = join "\n", map $_->{$file_field}, @files;
}
}
#next if $text =~ m!^\<html\>!i; # I don't know how to do this (yet)
sub columns {
return qw/id articleId displayName filename sizeInBytes description
contentType displayOrder forSale download whenUploaded
- requireUser/;
+ requireUser notes/;
}
1;
'select * from other_parents where childId = ? or parentId = ?',
addArticleFile =>
- 'insert into article_files values (null,?,?,?,?,?,?,?,?,?,?,?)',
+ 'insert into article_files values (null,?,?,?,?,?,?,?,?,?,?,?,?)',
replaceArticleFile =>
- 'replace article_files values (?,?,?,?,?,?,?,?,?,?,?,?)',
+ 'replace article_files values (?,?,?,?,?,?,?,?,?,?,?,?,?)',
deleteArticleFile => 'delete from article_files where id = ?',
getArticleFileByArticleId =>
'select * from article_files where articleId = ? order by displayOrder desc',
if (my $type = $cgi->param("contentType_$file->{id}")) {
$file->{contentType} = $type;
}
+ if (my $notes = $cgi->param("notes_$file->{id}")) {
+ $file->{notes} = $notes;
+ }
$file->{download} = 0 + defined $cgi->param("download_$file->{id}");
$file->{forSale} = 0 + defined $cgi->param("forSale_$file->{id}");
$file->{requireUser} = 0 + defined $cgi->param("requireUser_$file->{id}");
my %acts;
%acts =
(
- BSE::Util::Tags->basic(\%acts, $req->cgi, $req->cfg),
+ $req->dyn_user_tags(),
$it->make_iterator(undef, 'field', 'fields', $form->{fields}),
id => $form->{id},
value => [ \&tag_hash, $values ],
$article
or return 0;
- print STDERR "$args -> $article ($article->{id})\n";
-
$req->siteuser_has_access($article);
}
my $pageTitle;
my $words_re_str = '\b('.join('|', map quotemeta, @terms).')\b';
my $words_re = qr/$words_re_str/i;
+my @files;
+my $file_index;
my %acts;
%acts =
(
$pageTitle = $articles[$article_index]{pageTitle};
$pageTitle =~ s!$words_re!<b>$1</b>!g or $pageTitle = '';
$req->set_article(result => $articles[$article_index]);
+
+ # match files
+ @files = ();
+ for my $file ($articles[$article_index]->files) {
+ my $found;
+ my %fileout;
+ for my $field (qw(displayName description notes)) {
+ ++$found if ($fileout{$field} = $file->{$field})
+ =~ s!$words_re!<b>$1</b>!g;
+ }
+ if ($found) {
+ push @files, [ \%fileout, $file ];
+ }
+ }
return 1;
}
sub {
$pageTitle
},
+ ifMatchfiles => sub { @files },
+ matchfile_count => sub { @files },
+ iterate_matchfiles_reset => sub { $file_index = -1 },
+ iterate_matchfiles => sub { ++$file_index < @files },
+ matchfile =>
+ sub {
+ my ($args) = @_;
+ $file_index < @files or return '';
+ my $file_entry = $files[$file_index];
+ # already html escaped
+ exists $file_entry->[0]{$args} and return $file_entry->[0]{$args};
+
+ my $value = $file_entry->[1]{$args};
+ defined $value or return '';
+
+ escape_html($value);
+ },
ifResults => sub { scalar @results; },
ifSearch => sub { defined $words and length $words },
resultSeq => sub { $result_seq },
list => sub { popup_menu(-name=>'s', -id => 's',
-values=>\@sections,
- -labels=>\%sections) },
+ -labels=>\%sections,
+ -default=>$section) },
# result pages
iterate_pages =>
=head1 CHANGES
+=head2 0.15_24
+
+=over
+
+=item *
+
+if you did a search in a selected section, the search results page
+would leave the sections drop down back on "All Sections". It now
+correctly uses the previous section.
+
+=item *
+
+added a notes field to files attached to articles. This is indexed by
+the search engine. Note that the indexing of the description is split
+into the indexing of the displayName and description.
+
+=item *
+
+admin.pl now applies the dynamic page tags for dynamic articles.
+
+=item *
+
+fmail.pl's a_done target now uses the dynamic page tags.
+
+=item *
+
+search.pl now displays matching files (with the same limitations as
+current match displays)
+
+=item *
+
+removed from debug output
+
+=back
+
=head2 0.15_23
=over
</td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help file description:> <:error_img description:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">Notes:</th>
+ <td bgcolor="#FFFFFF">
+ <textarea name="notes" rows="10" cols="60" wrap="virtual"><:old notes:></textarea>
+ </td>
+ <td nowrap="nowrap" bgcolor="#FFFFFF"><:help file description:> <:error_img description:></td>
+ </tr>
<tr>
<th bgcolor="#FFFFFF" align="left">Content-Type:</th>
<td bgcolor="#FFFFFF">
<th width="50%" nowrap="nowrap" bgcolor="#FFFFFF"> File</th>
<th width="50%" nowrap="nowrap" bgcolor="#FFFFFF"> Description</th>
<th bgcolor="#FFFFFF" nowrap="nowrap"> Content-Type</th>
+ <th bgcolor="#FFFFFF">Notes</th>
</tr>
<: iterator begin files :>
<tr bgcolor="#FFFFFF">
<:ifUserCan edit_files_save:article:><input name="contentType_<:file id:>" type="text" value="<: file contentType :>" size="20" />
<:or:><: file contentType :><:eif:>
</td>
+ <td valign="top" rowspan="2">
+ <:ifUserCan edit_files_save:article:><textarea name="notes_<:file id:>" cols="40" rows="5"><:file notes:></textarea><:or:><:replace [file notes] "
+" "<br />" :><:eif:>
+ </td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="3">
<: iterator end files :>
<:ifUserCan edit_files_save:article:>
<tr>
- <td colspan="3" align="right" valign="bottom" bgcolor="#FFFFFF">
+ <td colspan="4" align="right" valign="bottom" bgcolor="#FFFFFF">
<input type="submit" name="filesave" value=" Save changes " />
</td>
</tr>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#808080">
Author: <:author:></font><:or Author:><:eif Author:><:if PageTitle:><br>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#808080">
- Page title: <:PageTitle:></font><:or PageTitle:><:eif PageTitle:></dl>
+ Page title: <:PageTitle:></font><:or PageTitle:><:eif PageTitle:>
+<:if Matchfiles:><:iterator begin matchfiles:>
+<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>File match:</b> <:matchfile description:> - <:matchfile displayName:><br />
+<:dynreplace [matchfile notes] "
+" "<br />":></font></p>
+<:iterator end matchfiles:><:or Matchfiles:><:eif Matchfiles:>
+</dl>
<: iterator separator results:> <: iterator end results:>
<hr noshade size="1" width="100%">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Result Pages: | <:iterator