0.15_24 commit r0_15_24
authorTony Cook <tony@develop-help.com>
Fri, 29 Jul 2005 09:39:25 +0000 (09:39 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Fri, 29 Jul 2005 09:39:25 +0000 (09:39 +0000)
13 files changed:
Makefile
schema/bse.sql
site/cgi-bin/admin/admin.pl
site/cgi-bin/admin/makeIndex.pl
site/cgi-bin/modules/ArticleFile.pm
site/cgi-bin/modules/BSE/DB/Mysql.pm
site/cgi-bin/modules/BSE/Edit/Article.pm
site/cgi-bin/modules/BSE/UI/Formmail.pm
site/cgi-bin/modules/BSE/Util/DynamicTags.pm
site/cgi-bin/search.pl
site/docs/bse.pod
site/templates/admin/filelist.tmpl
site/templates/search_base.tmpl

index 56333f9d627fa89226437ce1d829094c2270d090..729c03c8baa6617d6d232e8828a2fdebf697df01 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.15_23
+VERSION=0.15_24
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
index cb832134c1aed27699238fd1b1308f987747a43a..5b1d2227d0e7e0dce62da1a3d845f36e1adf9951 100644 (file)
@@ -389,6 +389,9 @@ create table article_files (
   -- 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)
 );
 
index 3a783f6df968702a3ce2fbb33a8a3a507da533f2..e2e51fa144d36dc1aa2c792ef17eff43ffc02e67 100755 (executable)
@@ -32,9 +32,22 @@ if ($req->check_admin_logon()) {
     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
index f86ea87cd0db4e77dc79d207c647c54bd5181c66..d81de671ac35a99a21cc6c381bd7f4e476177a98 100755 (executable)
@@ -39,8 +39,9 @@ my %scores =
    keyword=>4,
    pageTitle=>5,
    author=>4,
-#   file_excerpt=>2,
+   file_displayName => 2,
    file_description=>2,
+   file_notes => 1,
   );
 
 for my $name (keys %scores) {
@@ -95,6 +96,8 @@ sub makeIndex {
   @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/);
@@ -123,9 +126,10 @@ sub makeIndex {
        $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)
index 8712b5726efe3bf795dc79f8285dd9dffefa842a..9d2c0be6bfde57b8bcc6c007d3d5c3c3d3aa0d53 100644 (file)
@@ -8,7 +8,7 @@ use vars qw/@ISA/;
 sub columns {
   return qw/id articleId displayName filename sizeInBytes description 
             contentType displayOrder forSale download whenUploaded
-            requireUser/;
+            requireUser notes/;
 }
 
 1;
index 7209441acb620351b415637a06ff16cd993b0d9e..e305a4ee4a54ecc9e494212d2aecaf9e7c1d5908 100644 (file)
@@ -112,9 +112,9 @@ EOS
    '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',
index 4fdcc10df1e0d056a3fbecec8c78a54017ffa0eb..5efaf85497f6d0dd21a48ab4f0865ec33a65b164 100644 (file)
@@ -2737,6 +2737,9 @@ sub filesave {
       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}");
index fcfc262f404019b04066fdbd85023c1ecd141392..b5f91a932dbfd22c38f5c621100a0815e0361635 100644 (file)
@@ -348,7 +348,7 @@ sub req_done {
   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 ],
index a1f85cdc8f906d180bdeedd47255bb09816dc413..23364b608123f06a7ecd52a4e51013bf104276dd 100644 (file)
@@ -56,8 +56,6 @@ sub tag_ifUserCanSee {
   $article
     or return 0;
 
-  print STDERR "$args -> $article ($article->{id})\n";
-
   $req->siteuser_has_access($article);
 }
 
index b0659d3876a8beb73ba0dec737947aee456eca33..8f7519913f309949fe451df0264e798865e99892 100755 (executable)
@@ -84,6 +84,8 @@ my $author;
 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 =
   (
@@ -108,6 +110,20 @@ my %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;
      }
@@ -146,6 +162,23 @@ my %acts;
    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 },
@@ -165,7 +198,8 @@ my %acts;
    resultSeq => sub { $result_seq },
    list => sub { popup_menu(-name=>'s', -id => 's',
                            -values=>\@sections,
-                           -labels=>\%sections) },
+                           -labels=>\%sections,
+                           -default=>$section) },
    
    # result pages
    iterate_pages =>
index f37c06c29d8249f01f80f4dea44b90d2cd5ceb2e..253bfb23e6ff2a60e947a216b7e3c41168383bde 100644 (file)
@@ -10,6 +10,41 @@ Maybe I'll add some other bits here.
 
 =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
index 9d4da060b268bdb95a57b6fc26962c51c7f5bf8d..dbfe346e17ea1f6ed5f3b870b7ebdd84945498a8 100644 (file)
             </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"> 
@@ -87,6 +94,7 @@
             <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>
index 96e30cf309d2a7ab4a1ee3383a1c57234a12d8f7..1e58884e2d50d66b2ca9bf89ccb3bcafa3bc5e18 100644 (file)
     <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