Changeset 3182 for trunk/protemix


Ignore:
Timestamp:
2002-06-25T21:07:30+12:00 (22 years ago)
Author:
sjboddie
Message:

* empty log message *

Location:
trunk/protemix
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/protemix/etc/collect.cfg

    r3177 r3182  
    1111
    1212plugin        GAPlug
    13 plugin        ProtemixPlug 
     13plugin        ProtemixPlug
    1414plugin        ArcPlug
    1515plugin        RecPlug
  • trunk/protemix/macros/style.dm

    r3177 r3182  
    126126</tr>
    127127</table>
    128 <div style="margin-left:10; margin-right:10; margin-bottom:10">
     128<center>
     129<table border="0" cellpadding="0" cellspacing="0" width="638"><tr><td>
    129130}
    130131
    131132_footer_ {
    132133_pagefooterextra_
    133 </div>
     134</td></tr></table>
    134135</body>
    135136</html>
  • trunk/protemix/perllib/plugins/ProtemixPlug.pm

    r3177 r3182  
    176176}
    177177
     178# don't want to convert character entities for now as mgpp appears to be broken
     179sub read_file {
     180    my ($self, $filename, $encoding, $language, $textref) = @_;
     181
     182    &BasPlug::read_file($self, $filename, $encoding, $language, $textref);
     183
     184    # Convert entities to their UTF8 equivalents
     185#    $$textref =~ s/&(lt|gt|amp|quot);/&z$1;/go;
     186#    $$textref =~ s/&([^;]+);/&ghtml::getcharequiv($1,1)/gseo;
     187#    $$textref =~ s/&z(lt|gt|amp|quot);/&$1;/go;
     188}
     189
     190
    1781911;
  • trunk/protemix/rename.pl

    r3168 r3182  
    9191    $noncss =~ s/\\\n/\n/sg;
    9292
     93    # Occurances of 2HCl (lowercase el) were mistakenly changed to 2HC1
     94    # (digit one) during OCR in some cases so we'll change them back
     95    $noncss =~ s/2HC1/2HCl/g;
     96
    9397    # alter <img> tags to support renamed files
    9498    $noncss =~ s/(<img src=\")([^\"]+)/$1 . &rename_file($2)/sige;
  • trunk/protemix/src/recpt/Makefile.in

    r3168 r3182  
    6767HEADERS = ptmxqueryaction.h ptmxdocaction.h
    6868
    69 SOURCES = ptmxmain.cpp ptmxqueryaction.cpp ptmxdocaction.cpp browsetools.cpp
     69SOURCES = ptmxmain.cpp ptmxqueryaction.cpp ptmxdocaction.cpp browsetools.cpp equivterms.cpp
    7070
    71 OBJECTS = ptmxmain.o ptmxqueryaction.o ptmxdocaction.o browsetools.o
     71OBJECTS = ptmxmain.o ptmxqueryaction.o ptmxdocaction.o browsetools.o equivterms.o
    7272
    7373EXEC    = ptmx
  • trunk/protemix/src/recpt/ptmxdocaction.cpp

    r3177 r3182  
    2727#include "ptmxdocaction.h"
    2828#include "OIDtools.h"
     29#include "querytools.h"
    2930
    3031ptmxdocaction::ptmxdocaction () {
     
    6263}
    6364
     65// overridden to format the querystring when highlighting text
     66void ptmxdocaction::output_document (const text_t &OID, cgiargsclass &args,
     67                     recptproto *collectproto, displayclass &disp,
     68                     outconvertclass &outconvert, ostream &textout,
     69                     ostream &logout) {
     70  FilterResponse_t inforesponse;
     71  FilterResponse_t queryresponse;
     72  text_tset metadata;
     73  bool getParents = false;
     74  bool highlight = false;
     75  int wanttext = 0;
     76  int arg_gt = args.getintarg("gt");
     77  text_t &collection = args["c"];
     78   
     79  // if we have a query string and highlighting is turned on we need
     80  // to redo the query to get the terms for highlighting
     81  if (args.getintarg("hl")) {
     82    FilterRequest_t request;
     83    comerror_t err;
     84    request.filterResultOptions = FRmatchTerms;
     85    text_t formattedstring = args["q"];
     86    format_querystring (formattedstring, args.getintarg("b"));
     87
     88    // ------ for ptmx collection
     89
     90    if (!args["c1"].empty() && args["c1"] != "Any") {
     91      //    formattedstring = "[" + args["c1"] + "]:CL";
     92      formattedstring = args["c1"];
     93    }
     94    if (!args["c2"].empty() && args["c2"] != "Any") {
     95      if (!formattedstring.empty()) formattedstring += " & ";
     96      //    formattedstring += "[" + args["c2"] + "]:CA";
     97      formattedstring += args["c2"];
     98    }
     99    if (!args["c3"].empty() && args["c3"] != "Any") {
     100      if (!formattedstring.empty()) formattedstring += " & ";
     101      //    formattedstring += "[" + args["c3"] + "]:CS";
     102      formattedstring += args["c3"];
     103    }
     104    if (!args["q"].empty()) {
     105      if (!formattedstring.empty()) formattedstring += " & ";
     106      formattedstring += args["q"];
     107    }
     108
     109    void insert_equiv_terms(text_t&); // declaration
     110    insert_equiv_terms(formattedstring);
     111   
     112    // --------------
     113
     114    if (!formattedstring.empty()) {
     115
     116      set_queryfilter_options (request, formattedstring, args);
     117      collectproto->filter (args["c"], request, queryresponse, err, logout);
     118      if (err != noError) {
     119    outconvertclass text_t2ascii;
     120    logout << text_t2ascii
     121           << "documentaction::output_document: call to QueryFilter failed "
     122           << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n";
     123    highlight = false;
     124      } else {
     125    highlight = true;
     126      }
     127    }
     128  }
     129
     130
     131  format_t *formatlistptr = new format_t();
     132  parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents);
     133
     134  metadata.insert ("hastxt");
     135  metadata.insert ("haschildren");
     136
     137  if (formatinfo.DocumentText == "[Text]")
     138    wanttext = 1;
     139  else {
     140    char *docformat = formatinfo.DocumentText.getcstr();
     141    if (strstr (docformat, "[Text]") != NULL)
     142      wanttext = 2;
     143    delete docformat;
     144  }
     145   
     146  if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) {
     147    int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint();
     148    int haschildren = inforesponse.docInfo[0].metadata["haschildren"].values[0].getint();
     149   
     150    if (arg_gt == 0) {
     151      output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
     152           OID, highlight, hastxt, wanttext, collection, collectproto,
     153           disp, outconvert, textout, logout);
     154
     155
     156    } else {
     157
     158      ResultDocInfo_t thisdocinfo = inforesponse.docInfo[0];
     159   
     160      // text is to be expanded
     161      text_t exOID = OID;
     162      if (haschildren != 1) exOID = get_parent (OID);
     163      if (exOID.empty()) exOID = OID;
     164   
     165      // if we're not in a document (i.e. we're in a top level classification)
     166      // we need to pass "is_classify = true" to get_contents so that it
     167      // doesn't recurse all the way through each document in the classification
     168      bool is_classify = false;
     169      if (args["d"].empty()) is_classify = true;
     170
     171      get_contents (exOID, is_classify, metadata, collection,
     172            collectproto, inforesponse, logout);
     173   
     174      ResultDocInfo_tarray::iterator sechere = inforesponse.docInfo.begin();
     175      ResultDocInfo_tarray::iterator secend = inforesponse.docInfo.end();
     176
     177      if (arg_gt == 1) {
     178    // check if there are more than 10 sections containing text to be expanded -
     179    // if there are output warning message - this isn't a great way to do this
     180    // since the sections may be very large or very small - one day I'll fix it
     181    // -- Stefan.
     182    int seccount = 0;
     183    while (sechere != secend) {
     184      int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
     185      if (shastxt == 1) seccount ++;
     186      if (seccount > 10) break;
     187      sechere ++;
     188    }
     189    if (seccount > 10) {
     190      // more than 10 sections so output warning message and text
     191      // for current section only
     192      textout << outconvert << disp << "_document:textltwarning_";
     193
     194      output_text (thisdocinfo, formatlistptr, queryresponse.termInfo,
     195               OID, highlight, hastxt, wanttext, collection,
     196               collectproto, disp, outconvert, textout, logout);
     197     
     198    }
     199    else arg_gt = 2;
     200      }
     201
     202      if (arg_gt == 2) {
     203    // get the text for each section
     204    sechere = inforesponse.docInfo.begin();
     205    int count = 0;
     206    while (sechere != secend) {
     207      textout << outconvert << disp << "\n<p><a name=" << (*sechere).OID << "></a>\n";
     208
     209      int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
     210
     211      output_text (*sechere, formatlistptr, queryresponse.termInfo,
     212               (*sechere).OID, highlight, shastxt, wanttext, collection,
     213               collectproto, disp, outconvert, textout, logout);
     214      count ++;
     215      sechere ++;
     216    }
     217      }
     218    }
     219  }
     220  delete formatlistptr;
     221}
  • trunk/protemix/src/recpt/ptmxdocaction.h

    r3168 r3182  
    4141  virtual void define_internal_macros (displayclass &disp, cgiargsclass &args,
    4242                       recptprotolistclass *protos, ostream &logout);
     43
     44  virtual void output_document (const text_t &OID, cgiargsclass &args,
     45                recptproto *collectproto, displayclass &disp,
     46                outconvertclass &outconvert, ostream &textout,
     47                ostream &logout);
     48
    4349};
    4450
  • trunk/protemix/src/recpt/ptmxqueryaction.cpp

    r3177 r3182  
    128128  }
    129129
    130   logout << outconvert << "formattedstring: " << formattedstring << "\n";
     130  // do synonym searching stuff
     131  int insert_equiv_terms(text_t&); // forward declaration
     132  insert_equiv_terms(formattedstring);
    131133
    132134  if (!formattedstring.empty()) {
Note: See TracChangeset for help on using the changeset viewer.