diff options
29 files changed, 2092 insertions, 2251 deletions
| @@ -23,9 +23,27 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.3.orig.tar.gz        better      * indentation levels reset -  * cgi, generated sample search form, rearranged presentation - -  * editor syntax highlighting, kate, kwrite visited +  * cgi, generated sample search form +    * presentation rearranged +    * additional result information provided +      * canned searches provided to show matched text or indexes in matched documents +      * links to odf text +      * new results defaults set +    * better highlighting of matches +    * footnotes and footnote references have links to the main text in which +      they are found + +  * manifest and concordance, output presentation title and author information +    more prominent + +  * editor syntax highlighting (for SiSU), visited/improved +    * diakonos +    * gedit +    * kate, kwrite +  * renamed directory "syntax" "editor-syntax-etc" +    * vim directory moved into editor-syntax-etc + +  * debian install, correctly map moved vim directory  %% sisu_0.55.2.orig.tar.gz (2007-07-07:27/6)  http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.2.orig.tar.gz diff --git a/data/doc/sisu/sisu_markup_samples/dfsg/gpl2.fsf.sst b/data/doc/sisu/sisu_markup_samples/dfsg/gpl2.fsf.sst index 1b161087..dfabc14e 100644 --- a/data/doc/sisu/sisu_markup_samples/dfsg/gpl2.fsf.sst +++ b/data/doc/sisu/sisu_markup_samples/dfsg/gpl2.fsf.sst @@ -1,6 +1,6 @@  % SiSU 0.38 -@title: GNU GENERAL PUBLIC LICENSE +@title: GNU GENERAL PUBLIC LICENSE v2  @author: Free Software Foundation diff --git a/data/doc/sisu/sisu_markup_samples/dfsg/gpl3.fsf.sst b/data/doc/sisu/sisu_markup_samples/dfsg/gpl3.fsf.sst index edf4e303..358accce 100644 --- a/data/doc/sisu/sisu_markup_samples/dfsg/gpl3.fsf.sst +++ b/data/doc/sisu/sisu_markup_samples/dfsg/gpl3.fsf.sst @@ -1,6 +1,6 @@  SiSU 0.52 -@title: GNU GENERAL PUBLIC LICENSE +@title: GNU GENERAL PUBLIC LICENSE v3  @author: Free Software Foundation diff --git a/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi b/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi index 521621b6..c196c756 100644 --- a/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi +++ b/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi @@ -6,918 +6,899 @@     * http://www.jus.uio.no/sisu/SiSU/download   * Description: generates naive cgi search form for search of sisu database (pgsql) -   * $Id$ + * Name: SiSU generated sample cgi search form - Copyright (C) 2006 Ralph Amissah - Copyright (C) 2005 Ralph Amissah (first release edition) - Copyright (C) 1997 Ralph Amissah (first edition) + * Description: generated sample cgi search form for SiSU +   (SiSU is a framework for document structuring, publishing and search) - * License: GPL 3 or later + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: -  Summary of GPL 3 +   SiSU, a framework for document structuring, publishing and search -  This program is free software; you can redistribute it and/or modify it -  under the terms of the GNU General Public License as published by the Free -  Software Foundation; either version 3 of the License, or (at your option) -  any later version. +   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007 Ralph Amissah -  This program is distributed in the hope that it will be useful, but WITHOUT -  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for -  more details. +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. -  You should have received a copy of the GNU General Public License along -  with this program; if not, write to the Free Software Foundation, Inc., -  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for +   more details. -  If you have Internet connection, the latest version of the GPL should be -  available at these locations: -    http://www.fsf.org/licenses/gpl.html -    http://www.gnu.org/copyleft/gpl.html -    http://www.jus.uio.no/sisu/gpl3.fsf +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. -  SiSU was first released to the public on January 4th 2005 +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licenses/gpl.html> +   <http://www.gnu.org/copyleft/gpl.html> +   <http://www.jus.uio.no/sisu/gpl.fsf> -  SiSU uses: + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system -  *  Standard SiSU markup syntax, -  *  Standard SiSU meta-markup syntax, and the -  *  Standard SiSU object citation numbering and system + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> -  © Ralph Amissah 1997, current 2006. -  All Rights Reserved. + * Download: +   <http://www.jus.uio.no/sisu/SiSU/download.html> - * Ralph Amissah ralph@amissah.com -   Ralph Amissah ralph.amissah@gmail.com + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com>  =end -require 'cgi' -require 'fcgi' -require 'dbi' -@version='sisu_search_pgsql' -@url_base="http://corundum:8081/_sisu/image" -host=%x{echo $HOSTNAME}.chomp! -@hosturl="http://#{host}" + -  ':8081' -@base="#@hosturl/cgi-bin/#@version.cgi" -user='ralph' -class Form -  def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') -    search_note='' if checked_searched !~/\S/ -    the_can='' if checked_url !~/\S/ -    search_field='' if checked_echo !~/\S/ -    @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_searched,@checked_url,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_ignore,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can -    @tip=if checked_tip =~/\S/ -      '<font size="2" color="#666666">text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; </font>' -    else '' -    end -  end -  def submission_form -      search_form=<<-WOK -<label for="find"><b>SiSU PgSQL Search Form (sample):</b></label> -<table cellpadding="2"> -<tr><td valign=\"top\"> -  <table cellpadding="2"> -    <form action="#@base" id="Test Form" method="post"> -    <tr><td valign=\"top\"> -      <!input type="text" id="find" name="find" value="#@search_field" /> -      <!input type="text" id="find" name="find" value="" /> -      <textarea id="find" name="find" type="text" rows="4" cols="30" maxlength="256">#@search_field</textarea><br /> -    </td><td valign=\"top\"><p> -      <select name="db" size="1"> -        #@selected_db -        <option value="SiSU_sisu">sisu</option> -        <option value="SiSU_document_samples_sisu_markup">document_samples_sisu_markup</option> -      </select><br /> -      <font size="2" color="#222222"> -      <input type="radio" name="view" value="index" #@checked_index> index -      <input type="radio" name="view" value="text" #@checked_text>  text -      </font> -      </p> -      <p><input type="submit" value="submit" /></p> +      require 'cgi' +      require 'fcgi' +      require 'dbi' +      @version='sisu_search_pgsql' +      @image_src="http://localhost/sisu/_sisu/image" +      @hosturl_db="http://localhost" +      @hosturl_files="http://www.jus.uio.no" +      @port="5432" +      user='' +      @@limit,@@offset=1000,0 +      @base="#@hosturl_db/cgi-bin/#@version.cgi" +      @@canned_search_url=@base +      @color_heading='#DDFFAA' +      @color_match='#ffff48' +      class Form +        def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can='') +          search_note='' if checked_searched !~/\S/ +          the_can='' if checked_url !~/\S/ +          search_field='' if checked_echo !~/\S/ +          @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can +          @tip=if checked_tip =~/\S/ +            '<font size="2" color="#666666">text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' +          else '' +          end +        end +        def submission_form +            search_form=<<-WOK +    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +    <html xmlns="http://www.w3.org/1999/xhtml"> +    <head> +    <title> +    SiSU search form (sample): SiSU information Structuring Universe +    </title> +    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +    <meta name="sourcefile" content="SiSU._sst" /> +    <link rel="generator" href="http://www.jus.uio.no/sisu" /> +    <link rel="shortcut icon" href="http://localhost/sisu/_sisu/image/rb7.ico" /> +    <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" /> +    </head> +    <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> +    <table summary="band" border="0" cellpadding="3" cellspacing="0"> +    <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="http://localhost/sisu/_sisu/image/sisu.png" alt="SiSU -->" /></a></td><td> +<!--    <p class="tiny"><a href="http://www.jus.uio.no/sisu/SiSU/"> http://www.jus.uio.no/sisu/SiSU/</a></p> --> +      <label for="find"><b>sample search form</b></label>      </td></tr> -  </table> -    #@search_note -  </td><td valign=\"top\"> -    #@tip -  </td></tr> -</table> -      <font size="2" color="#222222"> -      <input type="checkbox" name="echo" #@checked_echo> echo -      <input type="checkbox" name="searched" #@checked_searched> searched -      <input type="checkbox" name="url" #@checked_url> url -      <input type="checkbox" name="tip" #@checked_tip> search fields available -      <input type="checkbox" name="sql" #@checked_sql> sql statement -      </font> -      <br /> -      <input type="radio" name="checks" value="check_ignore" #@checked_ignore> use selected -      <input type="radio" name="checks" value="check_all" #@checked_all> check all -      <input type="radio" name="checks" value="check_none" #@checked_none> check none -      <br /> -  </form> -#@the_can -WOK -  end -end -class Search_request                                                       #% search_for -  attr_accessor :text1,:keywords,:title,:author,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid -  def initialize(search_field='',q='') -    @search_field,@q=search_field,q -    @text1=@keywords=@title=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid='' -    if @search_field=~/\S/ -      @text1=text_to_match('text:') -      @keywords=text_to_match('key(?:words?)?:') -      @title=text_to_match('title:')                  # DublinCore 1  - title -      @author=text_to_match('(?:author|creator)s?:')  # DublinCore 2  - creator/author -      @subject=text_to_match('subj(?:ect)?:')         # DublinCore 3  - subject -      @description=text_to_match('description:')      # DublinCore 4  - description -      @publisher=text_to_match('pub(?:lisher)?:')     # DublinCore 5  - publisher -      @contributor=text_to_match('contributor:')      # DublinCore 6  - contributor -      @date=text_to_match('date:')                    # DublinCore 7  - date dd-mm-yy -      @type=text_to_match('type:')                    # DublinCore 8  - type -      @format=text_to_match('format:')                # DublinCore 9  - format -      @identifier=text_to_match('identifier:')        # DublinCore 10 - identifier -      @source=text_to_match('source:')                # DublinCore 11 - source -      @language=text_to_match('language:')            # DublinCore 12 - language -      @relation=text_to_match('relation:')            # DublinCore 13 - relation -      @coverage=text_to_match('coverage:')            # DublinCore 14 - coverage -      @rights=text_to_match('rights:')                # DublinCore 15 - rights -      @comment=text_to_match('comment:') -      @abstract=text_to_match('abs(?:tract)?:') -      @owner=text_to_match('owner:') -      @date_created=text_to_match('date_created:') -      @date_issued=text_to_match('date_issued:') -      @date_modified=text_to_match('date_modified:') -      @date_available=text_to_match('date_available:') -      @date_valid=text_to_match('date_valid:') -      @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date -    else -      @text1=q['s1'] if q['s1']=~/\S/ -      @keywords=q['key'] if q['key']=~/\S/ -      @title=q['ti'] if q['ti']=~/\S/ -      @author=q['au'] if q['au']=~/\S/ -      @subject=q['sj'] if q['sj']=~/\S/ -      @description=q['dsc'] if q['dsc']=~/\S/ -      @publisher=q['pb'] if q['pb']=~/\S/ -      @contributor=q['cntr'] if q['cntr']=~/\S/ -      @date=q['dt'] if q['dt']=~/\S/ -      @type=q['ty'] if q['ty']=~/\S/ -      @identifier=q['id'] if q['id']=~/\S/ -      @source=q['src'] if q['src']=~/\S/ -      @language=q['lang'] if q['lang']=~/\S/ -      @relation=q['rel'] if q['rel']=~/\S/ -      @coverage=q['cov'] if q['cov']=~/\S/ -      @rights=q['cr'] if q['cr']=~/\S/ -      @comment=q['co'] if q['co']=~/\S/ -      @abstract=q['ab'] if q['ab']=~/\S/ -      @date_created=q['dtc'] if q['dtc']=~/\S/ -      @date_issued=q['dti'] if q['dti']=~/\S/ -      @date_modified=q['dtm'] if q['dtm']=~/\S/ -      @date_available=q['dta'] if q['dta']=~/\S/ -      @date_valid=q['dtv'] if q['dtv']=~/\S/ -    end -  end -  def text_to_match(identifier='') -    m=Hash.new -    m[:string]=/#{identifier}\s*(.+?)/ -    m[:string]=/#{identifier}\s*(.+?)(?:;|\n|\r|$)/ -    m[:word]=/#{identifier}[\s(]*(\S+)/ -    search_string=if @search_field =~m[:word] -      search_string=if @search_field =~m[:braces]: m[:braces].match(@search_field)[1] -      elsif @search_field =~m[:string]:            m[:string].match(@search_field)[1] -      else -        str=m[:word].match(@search_field)[1] -        str.gsub!(/[()]/,'') -        str +    </table> +    <form action="#@base" id="Test Form" method="post"> +      <table cellpadding="2"> +      <tr><td valign=\"top\"> +          <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#@search_field</textarea> +      </td> +      <td valign=\"top\"> +        #@tip +        #@search_note +        #@the_can +      </td></tr></table> +      <td valign=\"top\"><tr><td> +        <!input type="text" id="find" name="find" value="#@search_field" /> +        <!input type="text" id="find" name="find" value="" /> +        <font size="2" color="#222222"> +        <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below) +        <br /> +        <select name="db" size="1"> +          #@selected_db +              <option value="SiSU_pace">pace</option> +              <option value="SiSU_sisu">sisu</option> +        </select> +        <input type="submit" value="SiSU search" /> +        <input type="radio" name="view" value="index" #@checked_index> index +        <input type="radio" name="view" value="text" #@checked_text> text / grep +            <input type="checkbox" name="casesense" #@checked_case> case sensitive +        <br /> +          <input type="checkbox" name="echo" #@checked_echo> echo query +          <input type="checkbox" name="stats" #@checked_stats> result stats +          <input type="checkbox" name="url" #@checked_url> search url +          <input type="checkbox" name="searched" #@checked_searched> searched +          <input type="checkbox" name="tip" #@checked_tip> available fields +          <input type="checkbox" name="sql" #@checked_sql> sql statement +        <br /> +          checks: +          <input type="radio" name="checks" value="check_default" #@checked_default> default +          <input type="radio" name="checks" value="check_selected" #@checked_selected> selected +          <input type="radio" name="checks" value="check_all" #@checked_all> all +          <input type="radio" name="checks" value="check_none" #@checked_none> none +          </font> +      </td></tr> +      </table> +    </form> +      WOK +        end        end -      search_string.strip! -      search_string.gsub!(/\s+/,'+') -      search_string -    #else -    #  "__" -    end -  end -end -class Dbi_search_string -  def initialize(l,t,q) -    @l,@t,@q=l,t,q -  end -  def string -    search=Hash.new -    search[:search]=Array.new -    search[:flag]=false -    if @t =~/\S+/ or @q =~/\S+/ -      if @t =~/\S+/:     unescaped_search=CGI.unescape(@t) -      elsif @q =~/\S+/:  unescaped_search=CGI.unescape(@q) +      class Search_request                                                       #% search_for +        attr_accessor :text1,:keywords,:title,:author,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename +        def initialize(search_field='',q='') +          @search_field,@q=search_field,q +          @text1=@keywords=@title=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' +          if @search_field=~/\S/ +            @text1=text_to_match('text:') +            @keywords=text_to_match('key(?:words?)?:') +            @title=text_to_match('title:')                  # DublinCore 1  - title +            @author=text_to_match('(?:author|creator)s?:')  # DublinCore 2  - creator/author +            @subject=text_to_match('subj(?:ect)?:')         # DublinCore 3  - subject +            @description=text_to_match('description:')      # DublinCore 4  - description +            @publisher=text_to_match('pub(?:lisher)?:')     # DublinCore 5  - publisher +            @contributor=text_to_match('contributor:')      # DublinCore 6  - contributor +            @date=text_to_match('date:')                    # DublinCore 7  - date dd-mm-yy +            @type=text_to_match('type:')                    # DublinCore 8  - type +            @format=text_to_match('format:')                # DublinCore 9  - format +            @identifier=text_to_match('identifier:')        # DublinCore 10 - identifier +            @source=text_to_match('source:')                # DublinCore 11 - source +            @language=text_to_match('language:')            # DublinCore 12 - language +            @relation=text_to_match('relation:')            # DublinCore 13 - relation +            @coverage=text_to_match('coverage:')            # DublinCore 14 - coverage +            @rights=text_to_match('rights:')                # DublinCore 15 - rights +            @comment=text_to_match('comment:') +            @abstract=text_to_match('abs(?:tract)?:') +            @owner=text_to_match('owner:') +            @date_created=text_to_match('date_created:') +            @date_issued=text_to_match('date_issued:') +            @date_modified=text_to_match('date_modified:') +            @date_available=text_to_match('date_available:') +            @date_valid=text_to_match('date_valid:') +            @filename=text_to_match('filename:') +            @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date or @filename +          else +            @text1=q['s1'] if q['s1']=~/\S/ +            @keywords=q['key'] if q['key']=~/\S/ +            @title=q['ti'] if q['ti']=~/\S/ +            @author=q['au'] if q['au']=~/\S/ +            @subject=q['sj'] if q['sj']=~/\S/ +            @description=q['dsc'] if q['dsc']=~/\S/ +            @publisher=q['pb'] if q['pb']=~/\S/ +            @contributor=q['cntr'] if q['cntr']=~/\S/ +            @date=q['dt'] if q['dt']=~/\S/ +            @type=q['ty'] if q['ty']=~/\S/ +            @identifier=q['id'] if q['id']=~/\S/ +            @source=q['src'] if q['src']=~/\S/ +            @language=q['lang'] if q['lang']=~/\S/ +            @relation=q['rel'] if q['rel']=~/\S/ +            @coverage=q['cov'] if q['cov']=~/\S/ +            @rights=q['cr'] if q['cr']=~/\S/ +            @comment=q['co'] if q['co']=~/\S/ +            @abstract=q['ab'] if q['ab']=~/\S/ +            @date_created=q['dtc'] if q['dtc']=~/\S/ +            @date_issued=q['dti'] if q['dti']=~/\S/ +            @date_modified=q['dtm'] if q['dtm']=~/\S/ +            @date_available=q['dta'] if q['dta']=~/\S/ +            @date_valid=q['dtv'] if q['dtv']=~/\S/ +            @filename=q['fns'] if q['fns']=~/\S/ +            @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000 +            @@offset=q['off'] if q['off']=~/\d+/ # 0 +          end +        end +        def text_to_match(identifier='') +          m={ +            :string => /#{identifier}\s*(.+?)/, +            :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/, +            :word => /#{identifier}[\s(]*(\S+)/ +          } +          search_string=if @search_field =~m[:word] +            search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1] +            elsif @search_field =~m[:string];            m[:string].match(@search_field)[1] +            else +              str=m[:word].match(@search_field)[1] +              str.gsub!(/[()]/,'') +              str +            end +            search_string.strip! +            search_string.gsub!(/\s+/,'+') +            search_string +          #else +          #  "__" +          end +        end        end -      search_construct=Array.new -      unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~\( '") -      unescaped_search.gsub!(/(.+)/,"#@l~\( '\\1' \)") -      search_construct << unescaped_search -      search_construct=search_construct.join(' ') -      search[:search]                    << search_construct -      search[:flag]=true -      search -    end -    search -  end -end -class Dbi_search_statement -  attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format -  def initialize(conn,search_for,q) -    @conn=conn -    @text_search_flag=false -    search=Hash.new -    search[:text],search[:endnotes]=Array.new,Array.new -    st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1']).string -    se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1']).string -    @text_search_flag=st[:flag] -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << se[:search] -    end -    st=Dbi_search_string.new('metadata.keywords',search_for.keywords,q['key']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.title',search_for.title,q['ti']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.creator',search_for.author,q['au']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.subject',search_for.subject,q['sj']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.description',search_for.description,q['dsc']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.publisher',search_for.publisher,q['pb']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.contributor',search_for.contributor,q['cntr']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.date',search_for.date,q['dt']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.type',search_for.type,q['ty']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.identifier',search_for.identifier,q['id']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.source',search_for.source,q['src']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.language',search_for.language,q['lang']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.relation',search_for.relation,q['rel']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.coverage',search_for.coverage,q['cov']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.rights',search_for.rights,q['cr']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.comment',search_for.comment,q['co']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.abstract',search_for.abstract,q['ab']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    @search_text,@search_endnotes=Array.new,Array.new -                                                                           #% -    search[:text].each{|x| @search_text << "#{x} AND " } -    search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } -    @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') -    @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') -  end -  def sql_select_body -    %{SELECT metadata.title, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, documents.ocn ;} -  end -  def sql_select_endnotes -    %{SELECT metadata.title, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, endnotes.nr ;} -  end -  def sql_select_body_format -    %{<font color="#666666" size="2">#{sql_select_body}</font>} -  end -  def sql_select_endnotes_format -    %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} -  end -  def contents -    @conn.select_all(sql_select_body) -  end -  def endnotes -    @conn.select_all(sql_select_endnotes) -  end -end -class Tail -  def tail -    <<-'WOK' -<br /><hr /><br /> -<center><table align="center"bgcolor="#ffffff"><tr><td><font color="#666666"><table summary="" bgcolor="#ffffff" cellpadding="4" border="0" align="center"> - -<tr align="center"> -  <td align="center"><p class="center"><font color="#666666" size="2"> -  presentations' look and feel<br /> -  generated by<br /> -  <a href="http://www.jus.uio.no/sisu" ><img border="0" src="http://corundum:8081/_sisu/image/sisu.png" alt="SiSU on Debian/Gnu/Linux or a FreeBSD & Ruby - better ways, well actually, Way Better!" width="120" height="38"></a><br /> -  <a href="http://www.jus.uio.no/sisu" >SiSU</a><br /> -  version 0.36<br />2006w07/6 (20060218)<br /> - -  <table summary="SiSU rights" bgcolor="#ffffff" cellpadding="4" border="0" align="center" width="40%"> -    <sup>©</sup> Ralph Amissah<br /> -  1993, current 2007<br /> -  GPL 3<br /> -  <i>w3 since October 3 1993</i><br /> -  <a href="mailto://ralph@amissah.com" >ralph@amissah.com</a><br /> -</font></p> -</td></tr></table> - -<p><center><font color="#666666" size="2">Developed<br />using <a href="http://www.ruby-lang.org/en/">Ruby</a><br />on <a href="http://www.debian.org/">Debian/Gnu/Linux</a> software infrastructure,<br />with the usual GPL (or OSS) suspects.<br />Better - "performance, reliability, scalability, security<br />& total cost of ownership"<br />[not to mention flexibility & choice]<br /><br /><<<a href="http://www.jus.uio.no/sisu/">Way Better!</a>>></font></center></p><tr align="center"><td align="center"> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr> -  <td><p><font color="#666666" size="2"> -    If you have problems viewing pages on this site please update your browser: +      class Dbi_search_string +        def initialize(l,t,q,cse=false) +          @l,@t,@q,@c=l,t,q,cse +        end +        def string +          search={ :search => [],:flag => false } +          if @t =~/\S+/ or @q =~/\S+/ +            if @t =~/\S+/;     unescaped_search=CGI.unescape(@t) +            elsif @q =~/\S+/;  unescaped_search=CGI.unescape(@q) +            end +            search_construct=[] +            if @c +              unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~\( '") +              unescaped_search.gsub!(/(.+)/,"#@l~\( '\\1' \)") +            else +              unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~*\( '") +              unescaped_search.gsub!(/(.+)/,"#@l~*\( '\\1' \)") +            end +            search_construct << unescaped_search +            search_construct=search_construct.join(' ') +            search[:search]                    << search_construct +            search[:flag]=true +            search +          end +          search +        end +      end +      class Dbi_search_statement +        attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit +        def initialize(conn,search_for,q,c) +          @conn=conn +          @text_search_flag=false +          @sql_statement={ :body=>'',:endnotes=>'',:range=>'' } +          #@offset||=@@offset +          #@offset+=@@limit +          search={ :text => [],:endnotes => [] } +          cse=if c =~/\S/; true +          else false +          end +          st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1'],cse).string +          se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string +          @text_search_flag=st[:flag] +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << se[:search] +          end +          st=Dbi_search_string.new('metadata.keywords',search_for.keywords,q['key'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.title',search_for.title,q['ti'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.creator',search_for.author,q['au'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.subject',search_for.subject,q['sj'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.description',search_for.description,q['dsc'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.publisher',search_for.publisher,q['pb'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.contributor',search_for.contributor,q['cntr'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.date',search_for.date,q['dt'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.type',search_for.type,q['ty'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.identifier',search_for.identifier,q['id'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.source',search_for.source,q['src'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.language',search_for.language,q['lang'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.relation',search_for.relation,q['rel'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.coverage',search_for.coverage,q['cov'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.rights',search_for.rights,q['cr'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.comment',search_for.comment,q['co'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.abstract',search_for.abstract,q['ab'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.filename',search_for.filename,q['fns'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000 +          @@offset=q['off'] if q['off']=~/\d+/ # 0 +          @search_text,@search_endnotes=[],[] +                                                                                 #% +          search[:text].each{|x| @search_text << "#{x} AND " } +          @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') +          @search_text.gsub!(/(documents\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') +          search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') +          @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') +        end +        def sql_offset +          @@offset +        end +        def sql_limit +          @@limit +        end +        def sql_canned_search +          @offset_next=sql_offset.to_i + sql_limit.to_i +          @offset_previous=sql_offset.to_i - sql_limit.to_i +          def current +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + sql_offset.to_s +          end +          def next +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_next.to_s +          end +          def previous +            @offset_previous >= 0 ? (@@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : '' +          end +          def start +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + 0.to_s +          end +          self +        end +        def sql_canned_search_url(ok) +          if ok +            can=sql_canned_search +            page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i +            case page.to_s +            when /^1$/ +              %{<hr /><br /><center> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            when /^2$/ +              %{<hr /><br /><center> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            else +              %{<hr /><br /><center> +              <a href="#{can.start}">|<  </a> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            end +          else '' +          end +        end +        def sql_select_body +          limit ||=@@limit +          offset ||=@@offset +          @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} +          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} +          select=@sql_statement[:body] + ' ' + @sql_statement[:range] +          select +        end +        def sql_select_endnotes +          limit ||=@@limit +          offset ||=@@offset +          @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} +          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} +          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] +          select +        end +        def sql_select_body_format +          %{<font color="#666666" size="2">#{sql_select_body}</font>} +        end +        def sql_select_endnotes_format +          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} +        end +        def contents +          @conn.select_all(sql_select_body) +        end +        def endnotes +          @conn.select_all(sql_select_endnotes) +        end +      end +      def tail +        <<-'WOK' +    <br /><hr /><br /> +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="2" border="0"> +  <!-- widget sisu --> +<tr><td valign="top" width="10%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    <a href="http://www.jus.uio.no/sisu" > +      <img border="0" src="http://localhost/sisu/_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> +    </a> +  </font></p> +</td><td valign="top" width="45%"> +<!-- SiSU Rights --> +  <p class="tiny_left"><font color="#666666" size="2"> +    Generated by +    <a href="http://www.jus.uio.no/sisu" > +      SiSU</a> 0.55.3 2007-07-10 (2007w28/2) +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +    <b>SiSU</b></a> <sup>©</sup> Ralph Amissah +    1993, current 2007. +    All Rights Reserved. +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +      SiSU</a> +    is software for document structuring, publishing and search, +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +      www.jus.uio.no/sisu +    </a> +    and +    <a href="http://www.sisudoc.org" > +      www.sisudoc.org +    </a> +  <br /> +    <i>w3 since October 3 1993</i> +    <a href="mailto://ralph@amissah.com" > +      ralph@amissah.com +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU using: +    <br />Standard SiSU markup syntax, +    <br />Standard SiSU meta-markup syntax, and the +    <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system) +  <br /> +    <sup>©</sup> Ralph Amissah 1997, current 2007. +    All Rights Reserved.    </font></p> -</td></tr></table> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="2"> -If you have problems viewing pages on this site please update your browser: -</font> -</p> -</td></tr> -</table> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/epiphany/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Epiphany"> - Epiphany -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://galeon.sourceforge.net/" target="external"> -<img border="0" width="24" height="24" src="http://corundum:8081/_sisu/image/galeon.png" alt="Galeon"> - Galeon -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.microsoft.com/windows/ie/default.asp" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/internet.explorer.png" alt="MS I-Explorer"> -I-Explorer -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://kazehakase.sourceforge.jp/" target="external"> -Kazehakase</a> -<sup>®</sup> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.konqueror.org/" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/konqueror.png" alt="Konqueror"> -Konqueror</a> -<sup>®</sup> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.mozilla.org/" target="external"> -<img border="0" width="30" height="24" src="http://corundum:8081/_sisu/image/mozilla.png" alt="Mozilla"> -Mozilla -</a> -<a href="http://www.mozilla.org/products/firefox/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/firefox.png" alt="Firefox"> -<b>Firefox</b> -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://home.netscape.com/comprod/mirror/client_download.html" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/netscape.png" alt="Netscape"> -Netscape -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.opera.com/" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/opera.png" alt="Opera"> -Opera -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.apple.com/safari/" target="external"> -<img border="0" width="24" height="25" src="http://corundum:8081/_sisu/image/safari.png" alt="Safari"> -Safari -</a> -<sup>®</sup> -</font> -</p> -</td></tr> -</table> - -<table summary="lightweight browser and text browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="1"> -for console/text viewing: -</font> -</p> -</td> -<td> -<p> -<font color="#666666" size="1"> -<a href="http://elinks.or.cz/" target="external"> -<b>elinks</b> -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> -<b>links2</b> -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://w3m.sourceforge.net/" target="external"> -<b>w3m</b> -</a> -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -for lightweight gui (X) viewing try: -</font> -</p> -</td> -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.dillo.org/" target="external"> -Dillo -</a> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/epiphany/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Epiphany"> - Epiphany -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://galeon.sourceforge.net/" target="external"> -<img border="0" width="24" height="24" src="http://corundum:8081/_sisu/image/galeon.png" alt="Galeon"> - Galeon -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> -<b>links2 -g</b> -</a> -</font> -</p> -</td></tr> -</table> -</td></tr> - -<tr align="center"><td align="center"> - -<table summary="pdf viewer suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> - -<tr><td> -<p class="center"> -<font color="#666666" size="1"> -& for -<a href="http://www.adobe.com/products/acrobat/adobepdf.html" target="external"> -pdf -</a> -viewings of this site we recommend stand alone viewers -<br /> -(rather than web browser plugins): -</font> -</p>  </td></tr> -</table> - -<table summary="" bgcolor="#ffffff" cellpadding="4" border="0" align="center"> -<tr align="center"><td align="center"> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.adobe.com/products/acrobat/readstep2.html" target="external"> -<img border="0" height="18" width="15" src="http://corundum:8081/_sisu/image/b_pdf.png" alt="Adobe Acrobat Reader"> -Acrobat Reader -</a> -<sup>®</sup> - | -</font> -</p> -</td> - -<td> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/evince/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Evince"> -<b>Evince</b> -</a> -<sup>®</sup> -</font> -</p> -</td> - -<td> -<p class="center"><font color="#666666" size="1"> -<a href="http://www.cs.wisc.edu/~ghost/gv/" target="external"> - GhostView<sup>®</sup> </a>, -<a href="http://wwwthep.physik.uni-mainz.de/~plass/gv/" target="external"> -GV<sup>®</sup> -</a> -& -<a href="http://www.cs.wisc.edu/~ghost/gsview/" target="external"> -GSview<sup>®</sup> -</a> - | -</font> -</p> -</td> - -<td> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.foolabs.com/xpdf/" target="external"> -<img border="0" width="16" height="16" src="http://corundum:8081/_sisu/image/xpdf.png" alt="Xpdf"> - Xpdf -</a> -<sup>®</sup> -</font> -</p> +  <!-- widget way better --> +<tr><td valign="top" width="10%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    <a href="http://www.gnu.org/licenses/gpl.html"> +      <img border="0" src="http://localhost/sisu/_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU is released under +    <a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a> +    or later, +    <a href="http://www.gnu.org/licenses/gpl.html"> +      http://www.gnu.org/licenses/gpl.html +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU, developed using +    <a href="http://www.ruby-lang.org/en/"> +      Ruby +    </a> +    on +    <a href="http://www.debian.org/"> +      Debian/Gnu/Linux +    </a> +    software infrastructure, +    with the usual GPL (or OSS) suspects. +  <br /> +    Better - "performance, reliability, scalability, security & total cost of ownership" +    [not to mention flexibility & choice] +  <br /> +    Get With the Future +    <a href="http://www.jus.uio.no/sisu/"> +      Way Better! +    </a> +  </font></p>  </td></tr>  </table> - -</font></center></td></tr></table></center> <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a> -</body></html> -WOK -  end -end -@counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 -@counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','','' -FCGI.each_cgi do |cgi| -  begin # all code goes in begin section -    @search=Hash.new -    @search[:text],@search[:endnotes]=Array.new,Array.new -    q=CGI.new -    @db=if cgi['db'] =~/\S+/: -      @stub=/SiSU_(\S+)/.match(cgi['db'])[1] -      cgi['db'] -    else -      @stub='sisu' -      'SiSU_sisu' -    end -    checked_url,checked_searched,checked_tip,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,selected_db='','','','','','','','' -    if cgi['view']=~/text/: checked_index,checked_text='','checked' -    else                    checked_index,checked_text='checked','' -    end -    checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 -    checked_searched='checked' if cgi['searched'] =~/\S/ -    checked_tip='checked' if cgi['tip'] =~/\S/ -    checked_echo='checked' if cgi['echo'] =~/\S/ -    checked_sql='checked' if cgi['sql'] =~/\S/ -    if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 -      checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' -      checked_none='' -    elsif cgi['checks'] =~/check_none/ #or cgi['a'].to_i==0 -      checked_none='checked' -      checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' -    else checked_ignore='checked' -    end -    selected_db=case cgi['db'] -    when /SiSU_document_samples_sisu_markup/:        '<option value="SiSU_document_samples_sisu_markup">document_samples_sisu_markup</option>' -    when /SiSU_sisu/:        '<option value="SiSU_sisu">sisu</option>' -    end -    dbi="dbi:Pg:database=#{@db};port=5432" -    @conn=DBI.connect(dbi,user) -    search_field=cgi['find'] if cgi['find'] # =~/\S+/ -    @search_for=Search_request.new(search_field,q) #.analyze               #% search_for -                                                                           #% searches -    #Canned_search.new(@base,@search_for.text1,cgi) -    if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ -      s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ -      key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ -      ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ -      au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ -      sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ -      dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ -      pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ -      cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ -      dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ -      ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ -      id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ -      src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ -      lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ -      rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ -      cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ -      cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ -      co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ -      ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ -      dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ -      dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ -      dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ -      dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ -      dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ -      canned_search_url=if checked_all =~/checked/ -        "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" -      else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}&db=#{cgi['db']}&view=#{cgi['view']}&u=1&e=1" -      end -      @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 -      @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 -      canned_note='previous search url:' -    else -      canned_search_url="#@base?s1=United+Nations&db=documents&view=index" -      canned_note='search url example:' -    end -    if search_field =~/\S+/ -      analyze_format=search_field.gsub(/\s*\n/,'; ') -    elsif checked_all =~/checked/ or checked_url =~/checked/ -      canned_search=canned_search_url.scan(/(?:s1|au|ti)=[^&]+/) -      af=canned_search.join('; ') -      af.gsub!(/s1=/,'text: ') -      af.gsub!(/au=/,'author: ') -      af.gsub!(/ti=/,'title: ') -      af.gsub!(/%2B/,' ') -      analyze_format=af -      st=af.split(/\s*;\s*/) -      search_field=st.join("\n") -    end -    green=%{<font size="2" color="#004000">} -    the_can=%{<font size="2" color="#666666">#{canned_note}<br> <a href="#{canned_search_url}">#{canned_search_url}</a></font><br>} -    p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject='' -    p_text=%{text: #{green}#{@search_for.text1}</font><br>} if @search_for.text1 =~/\S+/ -    p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br>} if @search_for.keywords =~/\S+/ -    p_title=%{title: #{green}#{@search_for.title}</font><br>} if @search_for.title =~/\S+/ -    p_author=%{author: #{green}#{@search_for.author}</font><br>} if @search_for.author =~/\S+/ -    p_subject=%{subject: #{green}#{@search_for.subject}</font><br>} if @search_for.subject =~/\S+/ -    p_description=%{description: #{green}#{@search_for.description}</font><br>} if @search_for.description =~/\S+/ -    p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br>} if @search_for.publisher =~/\S+/ -    p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br>} if @search_for.contributor =~/\S+/ -    p_date=%{date: #{green}#{@search_for.date}</font><br>} if @search_for.date =~/\S+/ -    p_type=%{type: #{green}#{@search_for.type}</font><br>} if @search_for.type =~/\S+/ -    p_format=%{format: #{green}#{@search_for.format}</font><br>} if @search_for.format =~/\S+/ -    p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br>} if @search_for.identifier =~/\S+/ -    p_source=%{source: #{green}#{@search_for.source}</font><br>} if @search_for.source =~/\S+/ -    p_language=%{language: #{green}#{@search_for.language}</font><br>} if @search_for.language =~/\S+/ -    p_relation=%{relation: #{green}#{@search_for.relation}</font><br>} if @search_for.relation =~/\S+/ -    p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br>} if @search_for.coverage =~/\S+/ -    p_rights=%{rights: #{green}#{@search_for.rights}</font><br>} if @search_for.rights =~/\S+/ -    p_comment=%{comment: #{green}#{@search_for.comment}</font><br>} if @search_for.comment =~/\S+/ -    p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br>} if @search_for.abstract =~/\S+/ -    search_note=<<-WOK -<font size="2" color="#666666"> -<br><b>previous selection</b>:<br> -database: #{green}#@db</font>; selected view: #{green}#{cgi['view']}</font><br> -search string: "#{green}#{analyze_format}</font>"<br> -#{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} -</font> -WOK -    #eg = %{canned search e.g.:<br> <a href="#{url}">#{url}</a><br>find: #{analyze}<br>database: #{database}} -    #dbi_canning -    @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can).submission_form #% form -    @tail=Tail.new.tail -    unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ -      print "Content-type: text/html\n\n" -      puts (@header+@tail) -    else #% searches -      s1=if @search_for.text1 =~/\S/ -        @search_for.text1 -      else 'Unavailable' -      end -      @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} -      @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} -    #dbi_request -      dbi_statement=Dbi_search_statement.new(@conn,@search_for,q) -      @text_search_flag=false -      @text_search_flag=dbi_statement.text_search_flag -      s_contents=dbi_statement.contents -      s_endnotes=dbi_statement.endnotes -      @body_main=Array.new -      @endnotes=Array.new -      oldtid=0 -      if @text_search_flag -        if checked_sql =~/\S/ -          sql_select_body=dbi_statement.sql_select_body_format -          sql_select_endnotes=dbi_statement.sql_select_endnotes_format -        else sql_select_body,sql_select_endnotes='','' -        end -        @body_main << "<p><hr><br><b>Main Text:</b><br>" << sql_select_body -        @endnotes  << "<p><hr><br><b>Endnotes:</b><br>"  << sql_select_endnotes -      else +    <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a> +    </body></html> +    WOK        end -      #text_objects_body -      s_contents.each do |c|                                               #% text body -        location=c["filename"][/(.+?)\.ss[ftms]/, 1] -        file_suffix=c["filename"][/.+?\.(ss[ftms])/, 1] -      #metadata_found_body -        if c["tid"].to_i != oldtid.to_i -          title=%{<a href="#@hosturl/#@stub/#{location}/">#{c["title"]}</a> by #{c["creator"]} <a href="#@hosturl/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@url_base/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@url_base/b_pdf.png" alt="pdf landscape"></a><br>}  if file_suffix=~/s/ #hmm watch file_suffix -           if @text_search_flag: title='<br><hr>'+title -           else                  title='<br>'+title -           end -           @counter_txt_doc+=1 -           oldtid=c["tid"].to_i -          else                    title='' -          end -          if @text_search_flag -            if cgi['view']=~/text/                                         #% txt body -              text=if c["suffix"] !~/1/ #seg -                if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! -                  if @search_for.text1 =~/\S+/:     unescaped_search=CGI.unescape(@search_for.text1) -                  elsif q['s1'] =~/\S+/:           unescaped_search=CGI.unescape(q['s1']) +      @tail=tail +      @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 +      @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','','' +      FCGI.each_cgi do |cgi| +        begin # all code goes in begin section +          @search={ :text => [],:endnotes => [] } +          q=CGI.new +          @db=if cgi['db'] =~/\S+/; +            @stub=/SiSU_(\S+)/.match(cgi['db'])[1] +            cgi['db'] +          else +            @stub='sisu' +            'SiSU_sisu' +          end +          checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' +          if cgi['view']=~/text/; checked_index,checked_text='','checked' +          else                    checked_index,checked_text='checked','' +          end +          checked_echo='checked' if cgi['echo'] =~/\S/ +          checked_stats='checked' if cgi['stats'] =~/\S/ +          checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 +          checked_searched='checked' if cgi['searched'] =~/\S/ +          checked_tip='checked' if cgi['tip'] =~/\S/ +          checked_case='checked' if cgi['casesense'] =~/\S/ +          checked_sql='checked' if cgi['sql'] =~/\S/ +          if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 +            checked_all='checked' +            checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' +            checked_none='' +          elsif cgi['checks'] =~/check_none/ +            checked_none='checked' +            checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' +          elsif cgi['checks'] =~/check_selected/ +            checked_selected='checked' +          elsif cgi['checks'] =~/check_default/ +            checked_default='checked' +            checked_echo=checked_stats=checked_url='checked' +            checked_searched=checked_tip=checked_case=checked_sql='' +          else +            checked_selected='checked' +            checked_echo=checked_stats=checked_url='checked' +            checked_searched=checked_tip=checked_case=checked_sql='' +          end +          selected_db=case cgi['db'] +          when /SiSU_pace/;        '<option value="SiSU_pace">pace</option>' +          when /SiSU_sisu/;        '<option value="SiSU_sisu">sisu</option>' +          end +          dbi="dbi:Pg:database=#{@db};port=#{@port}" +          @conn=DBI.connect(dbi,user) +          search_field=cgi['find'] if cgi['find'] # =~/\S+/ +          @search_for=Search_request.new(search_field,q) #.analyze               #% search_for +                                                                                 #% searches +          #Canned_search.new(@base,@search_for.text1,cgi) +          if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ +            s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ +            key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ +            ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ +            au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ +            sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ +            dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ +            pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ +            cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ +            dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ +            ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ +            id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ +            src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ +            lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ +            rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ +            cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ +            cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ +            co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ +            ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ +            dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ +            dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ +            dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ +            dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ +            dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ +            fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ +            @@canned_search_url=if checked_all =~/checked/ +              "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" +            else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" +            end +            @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" +            if checked_case=~/\S/ +              @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 +              @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 +            else +              @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 +              @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 +            end +            canned_note='search url:' +          else +            @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" +            canned_note='search url example:' +          end +          if search_field =~/\S+/ +            analyze_format=search_field.gsub(/\s*\n/,'; ') +          elsif checked_all =~/checked/ or checked_url =~/checked/ +            canned_search=@@canned_search_url.scan(/(?:s1|au|ti|fns)=[^&]+/) +            af=canned_search.join('; ') +            af.gsub!(/s1=/,'text: ') +            af.gsub!(/au=/,'author: ') +            af.gsub!(/ti=/,'title: ') +            af.gsub!(/fns=/,'filename: ') +            af.gsub!(/%2B/,' ') +            analyze_format=af +            st=af.split(/\s*;\s*/) +            search_field=st.join("\n") +          end +          green=%{<font size="2" color="#004000">} +          canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) +          the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />} +          p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject=p_filename='' +          p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/ +          p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br />} if @search_for.keywords =~/\S+/ +          p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/ +          p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/ +          p_subject=%{subject: #{green}#{@search_for.subject}</font><br />} if @search_for.subject =~/\S+/ +          p_description=%{description: #{green}#{@search_for.description}</font><br />} if @search_for.description =~/\S+/ +          p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br />} if @search_for.publisher =~/\S+/ +          p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/ +          p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/ +          p_type=%{type: #{green}#{@search_for.type}</font><br />} if @search_for.type =~/\S+/ +          p_format=%{format: #{green}#{@search_for.format}</font><br />} if @search_for.format =~/\S+/ +          p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br />} if @search_for.identifier =~/\S+/ +          p_source=%{source: #{green}#{@search_for.source}</font><br />} if @search_for.source =~/\S+/ +          p_language=%{language: #{green}#{@search_for.language}</font><br />} if @search_for.language =~/\S+/ +          p_relation=%{relation: #{green}#{@search_for.relation}</font><br />} if @search_for.relation =~/\S+/ +          p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br />} if @search_for.coverage =~/\S+/ +          p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/ +          p_comment=%{comment: #{green}#{@search_for.comment}</font><br />} if @search_for.comment =~/\S+/ +          p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br />} if @search_for.abstract =~/\S+/ +          p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/ +          search_note=<<-WOK +      <font size="2" color="#666666"> +      <b>database:</b> #{green}#@db</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> +      <b>search string:</b> "#{green}#{analyze_format}</font>"<br /> +      #{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} +      </font> +      WOK +          #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} +          #dbi_canning +          @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form +          unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ +            print "Content-type: text/html\n\n" +            puts (@header+@tail) +          else #% searches +            s1=if @search_for.text1 =~/\S/ +              @search_for.text1 +            else 'Unavailable' +            end +            if checked_case=~/\S/ +              @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} +              @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} +            else +              @search[:text]<<%{documents.clean~*'#{CGI.unescape(s1)}'} +              @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} +            end +          #dbi_request +            dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case) +            @text_search_flag=false +            @text_search_flag=dbi_statement.text_search_flag +            s_contents=dbi_statement.contents +            s_endnotes=dbi_statement.endnotes +            @body_main,@endnotes=[],[] +            @search_regx=nil +            oldtid=0 +            if @text_search_flag +              if checked_sql =~/\S/ +                sql_select_body=dbi_statement.sql_select_body_format +                sql_select_endnotes=dbi_statement.sql_select_endnotes_format +              else sql_select_body,sql_select_endnotes='','' +              end +              @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body +              @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes +            else +            end +            #text_objects_body +            s_contents.each do |c|                                               #% text body +              location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +              file_suffix=c['filename'][/.+?\.(_?sst|ssm)$/,1] +              lang=if location =~ /\S+?~(\S\S\S?)$/ +                l=location[/\S+?~(\S\S\S?)$/,1] +                location.gsub!(/(\S+?)~\S\S\S?/,'\1') +                l=".#{l}" +              else '' +              end +            #metadata_found_body +              if c['tid'].to_i != oldtid.to_i +                ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" +                else c['title'] +                end +                can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                end +                title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix +                if @text_search_flag; title='<br /><hr>'+title +                else                  title='<br />'+title +                end +                @counter_txt_doc+=1 +                oldtid=c['tid'].to_i +              else                    title='' +              end +              if @text_search_flag +                if cgi['view']=~/text/                                         #% txt body +                  text=if c['suffix'] !~/1/ #seg +                    if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! +                      unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) +                      elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1']) +                      else nil +                      end +                      @search_regx=if unescaped_search                                     #check +                        search_regex=[] +                        build=unescaped_search.scan(/\S+/).each do |g| +                           if g.to_s =~/(AND|OR)/ +                             search_regex << '|' +                           else search_regex << %{#{g.to_s}} +                           end +                        end +                        search_regex=search_regex.join(' ') +                        search_regex=search_regex.gsub(/\s*\|\s*/,'|') +                        Regexp.new(search_regex, Regexp::IGNORECASE) +                      else nil +                      end +                    else nil +                    end +                    matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                      matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                    else c['body'] +                    end +                    %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} +                  elsif c['suffix'] =~/1/ #doc +                    %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} +                  end +                  @counter_txt_ocn+=1 +                  output=if c['seg'] =~/\S+/; title+text +                  else                        text                    end -                  search_regex=Array.new -                  build=unescaped_search.scan(/\S+/).each do |g| -                     if g.to_s =~/(AND|OR)/ -                       search_regex << '|' -                     else search_regex << %{#{g.to_s}} -                     end +                elsif cgi['view']=~/index/                                     #% idx body +                  if c['suffix'] !~/1/ #seg +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag +                  elsif c['suffix'] =~/1/ #doc +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                  end +                  if c['seg'] =~/\S+/ +                    if @text_search_flag +                      @counter_txt_ocn+=1 +                      output=title+index +                    end +                  else +                    @counter_txt_ocn+=1 +                    output=unless c['suffix'] =~/1/; title+index +                    else %{#{title}#{c['ocn'].sort}, } +                    end                    end -                  search_regex=search_regex.join(' ') -                  search_regex=search_regex.gsub(/\s*\|\s*/,'|') -                  @search_regx=search_regex.to_s                  end -                matched_para=c["body"].gsub(/(#@search_regx)/i,%{<span style="background-color: #ffff48">\\1</span>}) -                %{<hr><p><font size="2">ocn <b><a href="#@hosturl/#@stub/#{location}/#{c["seg"]}.html##{c["ocn"]}">#{c["ocn"]}</a></b>:</font></p>#{matched_para}} -              elsif c["suffix"] =~/1/ #doc -                %{#{title}<hr><p><font size="2">ocn #{c["ocn"]}:#{c["body"]}} +              else output=title                end -              @counter_txt_ocn+=1 -              output=if c["seg"] =~/\S+/: title+text -              else                        text +              @counters_txt=if @counter_txt_doc > 0 +                if checked_stats =~/\S/ +                  @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                  %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />} +                else '' +                end +              else ''                end -            elsif cgi['view']=~/index/                                     #% idx body -              if c["suffix"] !~/1/ #seg -                index=%{<a href="#@hosturl/#@stub/#{location}/#{c["seg"]}.html##{c["ocn"]}">#{c["ocn"]}</a>, } if @text_search_flag -              elsif c["suffix"] =~/1/ #doc -                index=%{<a href="#@hosturl/#@stub/#{location}/doc.html##{c["ocn"]}">#{c["ocn"]}</a>, } +              @body_main << output #+ details +            end +            #text_objects_endnote +            oldtid = 0 +            s_endnotes.each do |e|                                               #% endnotes +              location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +              file_suffix=e['filename'][/.+?\.(_?sst|ssm)$/,1] +              lang=if location =~ /\S+?~(\S\S\S?)$/ +                l=location[/\S+?~(\S\S\S?)$/,1] +                location.gsub!(/(\S+?)~\S\S\S?/,'\1') +                l=".#{l}" +              else ''                end -              if c["seg"] =~/\S+/ -                if @text_search_flag -                  @counter_txt_ocn+=1 -                  output=title+index +            #metadata_found_endnotes +              if @text_search_flag +                if e['metadata_tid'].to_i != oldtid.to_i +                  ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" +                  else e['title'] +                  end +                  can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  end +                  title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ +                  @counter_endn_doc+=1 +                  oldtid=e['metadata_tid'].to_i +                else title = '' +                end +                if cgi['view']=~/text/                                           #% txt endnotes +                  @counter_endn_ocn+=1 +                  matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                    matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                  else e['body'] +                  end +                  output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} +                elsif cgi['view']=~/index/                                       #% idx endnotes +                  @counter_endn_ocn+=1 +                  output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], }                  end -              else -                @counter_txt_ocn+=1 -                output=unless c["suffix"] =~/1/: title+index -                else %{#{title}#{c["ocn"].sort}, } +                @counters_endn=if @counter_endn_doc > 0 +                  if checked_stats =~/\S/ +                  @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                    %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.</font><br />} +                  else '' +                  end                  end +                @endnotes << output #+ details +              else @endnotes=[] #does not take out yet                end              end -          else output=title +            offset=dbi_statement.sql_offset.to_s +            limit=dbi_statement.sql_limit.to_s +            @@lt_t ||=false; @@lt_e ||=false +            canned=if (@@lt_t or @@lt_e) +              dbi_statement.sql_canned_search_url(true).to_s +            else +              dbi_statement.sql_canned_search_url(false).to_s +            end +            limit=dbi_statement.sql_limit.to_s +            cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes            end -        @counters_txt=if @counter_txt_doc > 0 -          %{<font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.</font><br />} -        else '' -        end -        @body_main << output #+ details -      end -      #text_objects_endnote -      oldtid = 0 -      s_endnotes.each do |e|                                               #% endnotes -        location=e["filename"][/(.+?)\.ss[ftms]/, 1] -        file_suffix=e["filename"][/.+?\.(ss[ftms])/, 1] -      #metadata_found_endnotes -        if @text_search_flag -          if e["metadata_tid"].to_i != oldtid.to_i -            title=%{<br><hr><a href="#@hosturl/#@stub/#{location}/">#{e["title"]}</a> by #{e["creator"]} <a href="#@hosturl/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@url_base/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@url_base/b_pdf.png" alt="pdf landscape"></a><br>}  if file_suffix=~/s/ -            @counter_endn_doc+=1 -            oldtid=e["metadata_tid"].to_i -          else title = '' -          end -          if cgi['view']=~/text/                                           #% txt endnotes -            @counter_endn_ocn+=1 -            matched_endnote=e["body"].gsub(/(#@search_regx)/i,%{<span style="background-color: #ffff48">\\1</span>}) -            output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl/#@stub/#{location}/endnotes.html##{e["nr"]}">#{e["nr"]}</a></b> referred to from ocn <a href="#@hosturl/#@stub/#{location}/doc.html##{e["ocn"]}">#{e["ocn"]}</a>:</font> #{matched_endnote}} -          elsif cgi['view']=~/index/                                       #% idx endnotes -            @counter_endn_ocn+=1 -            output=%{#{title}<a href="#@hosturl/#@stub/#{location}/endnotes.html#_#{e["nr"]}">#{e["nr"]}</a> [§ <a href="#@hosturl/#@stub/#{location}/doc.html##{e["ocn"]}">#{e["ocn"]}</a>], } -          end -          @counters_endn=if @counter_endn_doc > 0 -          %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.</font><br />} -          end -          @endnotes << output #+ details -        else @endnotes=Array.new #does not take out yet +        rescue Exception => e +          s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) +          s << CGI::escapeHTML(e.message) + '</pre>' +          cgi.out{s} +          next +        ensure # eg. disconnect from server +          @conn.disconnect if @conn          end        end -      cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + @tail} #% print cgi_output_header+counters+body+endnotes -    end -  rescue Exception => e -    s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) -    s << CGI::escapeHTML(e.message) + '</pre>' -    cgi.out{s} -    next -  ensure # eg. disconnect from server -    @conn.disconnect if @conn -  end -end diff --git a/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi b/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi index 692d8802..34bb3748 100644 --- a/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi +++ b/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi @@ -6,927 +6,896 @@     * http://www.jus.uio.no/sisu/SiSU/download   * Description: generates naive cgi search form for search of sisu database (sqlite) -   * $Id$ + * Name: SiSU generated sample cgi search form - Copyright (C) 2006 Ralph Amissah - Copyright (C) 2005 Ralph Amissah (first release edition) - Copyright (C) 1997 Ralph Amissah (first edition) + * Description: generated sample cgi search form for SiSU +   (SiSU is a framework for document structuring, publishing and search) - * License: GPL 3 or later + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: -  Summary of GPL 3 +   SiSU, a framework for document structuring, publishing and search -  This program is free software; you can redistribute it and/or modify it -  under the terms of the GNU General Public License as published by the Free -  Software Foundation; either version 3 of the License, or (at your option) -  any later version. +   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007 Ralph Amissah -  This program is distributed in the hope that it will be useful, but WITHOUT -  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for -  more details. +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. -  You should have received a copy of the GNU General Public License along -  with this program; if not, write to the Free Software Foundation, Inc., -  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for +   more details. -  If you have Internet connection, the latest version of the GPL should be -  available at these locations: -    http://www.fsf.org/licenses/gpl.html -    http://www.gnu.org/copyleft/gpl.html -    http://www.jus.uio.no/sisu/gpl3.fsf +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. -  SiSU was first released to the public on January 4th 2005 +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licenses/gpl.html> +   <http://www.gnu.org/copyleft/gpl.html> +   <http://www.jus.uio.no/sisu/gpl.fsf> -  SiSU uses: + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system -  *  Standard SiSU markup syntax, -  *  Standard SiSU meta-markup syntax, and the -  *  Standard SiSU object citation numbering and system + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> -  © Ralph Amissah 1997, current 2006. -  All Rights Reserved. + * Download: +   <http://www.jus.uio.no/sisu/SiSU/download.html> - * Ralph Amissah ralph@amissah.com -   Ralph Amissah ralph.amissah@gmail.com + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com>  =end -require 'cgi' -require 'fcgi' -require 'dbi' -@version='sisu_search_sqlite' -@url_base="http://corundum:8081/_sisu/image" -host=%x{echo $HOSTNAME}.chomp! -@hosturl="http://#{host}" + -  ':8081' -@base="#@hosturl/cgi-bin/#@version.cgi" -class Form -  def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') -    search_note='' if checked_searched !~/\S/ -    the_can='' if checked_url !~/\S/ -    search_field='' if checked_echo !~/\S/ -    @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_searched,@checked_url,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_ignore,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can -    @tip=if checked_tip =~/\S/ -      '<font size="2" color="#666666">text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; </font>' -    else '' -    end -  end -  def submission_form -      search_form=<<-WOK -<label for="find"><b>SiSU SQLite Search Form (sample):</b></label> -<table cellpadding="2"> -<tr><td valign=\"top\"> -  <table cellpadding="2"> -    <form action="#@base" id="Test Form" method="post"> -    <tr><td valign=\"top\"> -      <!input type="text" id="find" name="find" value="#@search_field" /> -      <!input type="text" id="find" name="find" value="" /> -      <textarea id="find" name="find" type="text" rows="4" cols="30" maxlength="256">#@search_field</textarea><br /> -    </td><td valign=\"top\"><p> -      <select name="db" size="1"> -        #@selected_db -        <option value="SiSU_document_samples_sisu_markup">SiSU examples</option> -        <option value="SiSU_sisu">SiSU</option> -        <option value="SiSU_sisu-dev">SiSU dev</option> -        <option value="SiSU_books">Books</option> -        <option value="SiSU_articles">Articles</option> -        <option value="SiSU_agreements">Agreements</option> -        <option value="SiSU_conventions">Conventions</option> -      </select><br /> -      <font size="2" color="#222222"> -      <input type="radio" name="view" value="index" #@checked_index> index -      <input type="radio" name="view" value="text" #@checked_text>  text -      </font> -      </p> -      <p><input type="submit" value="submit" /></p> +      require 'cgi' +      require 'fcgi' +      require 'dbi' +      @version='sisu_search_sqlite' +      @image_src="http://localhost/sisu/_sisu/image" +      @hosturl_db="http://localhost" +      @hosturl_files="http://www.jus.uio.no" +      @@limit,@@offset=1000,0 +      @base="#@hosturl_db/cgi-bin/#@version.cgi" +      @@canned_search_url=@base +      @color_heading='#DDFFAA' +      @color_match='#ffff48' +      class Form +        def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can='') +          search_note='' if checked_searched !~/\S/ +          the_can='' if checked_url !~/\S/ +          search_field='' if checked_echo !~/\S/ +          @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can +          @tip=if checked_tip =~/\S/ +            '<font size="2" color="#666666">text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' +          else '' +          end +        end +        def submission_form +            search_form=<<-WOK +    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +    <html xmlns="http://www.w3.org/1999/xhtml"> +    <head> +    <title> +    SiSU search form (sample): SiSU information Structuring Universe +    </title> +    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +    <meta name="sourcefile" content="SiSU._sst" /> +    <link rel="generator" href="http://www.jus.uio.no/sisu" /> +    <link rel="shortcut icon" href="http://localhost/sisu/_sisu/image/rb7.ico" /> +    <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" /> +    </head> +    <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> +    <table summary="band" border="0" cellpadding="3" cellspacing="0"> +    <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="http://localhost/sisu/_sisu/image/sisu.png" alt="SiSU -->" /></a></td><td> +<!--    <p class="tiny"><a href="http://www.jus.uio.no/sisu/SiSU/"> http://www.jus.uio.no/sisu/SiSU/</a></p> --> +      <label for="find"><b>sample search form</b></label>      </td></tr> -  </table> -    #@search_note -  </td><td valign=\"top\"> -    #@tip -  </td></tr> -</table> -      <font size="2" color="#222222"> -      <input type="checkbox" name="echo" #@checked_echo> echo -      <input type="checkbox" name="searched" #@checked_searched> searched -      <input type="checkbox" name="url" #@checked_url> url -      <input type="checkbox" name="tip" #@checked_tip> search fields available -      <input type="checkbox" name="sql" #@checked_sql> sql statement -      </font> -      <br /> -      <input type="radio" name="checks" value="check_ignore" #@checked_ignore> use selected -      <input type="radio" name="checks" value="check_all" #@checked_all> check all -      <input type="radio" name="checks" value="check_none" #@checked_none> check none -      <br /> -  </form> -#@the_can -WOK -  end -end -class Search_request                                                       #% search_for -  attr_accessor :text1,:keywords,:title,:author,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid -  def initialize(search_field='',q='') -    @search_field,@q=search_field,q -    @text1=@keywords=@title=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid='' -    if @search_field=~/\S/ -      @text1=text_to_match('text:') -      @keywords=text_to_match('key(?:words?)?:') -      @title=text_to_match('title:')                  # DublinCore 1  - title -      @author=text_to_match('(?:author|creator)s?:')  # DublinCore 2  - creator/author -      @subject=text_to_match('subj(?:ect)?:')         # DublinCore 3  - subject -      @description=text_to_match('description:')      # DublinCore 4  - description -      @publisher=text_to_match('pub(?:lisher)?:')     # DublinCore 5  - publisher -      @contributor=text_to_match('contributor:')      # DublinCore 6  - contributor -      @date=text_to_match('date:')                    # DublinCore 7  - date dd-mm-yy -      @type=text_to_match('type:')                    # DublinCore 8  - type -      @format=text_to_match('format:')                # DublinCore 9  - format -      @identifier=text_to_match('identifier:')        # DublinCore 10 - identifier -      @source=text_to_match('source:')                # DublinCore 11 - source -      @language=text_to_match('language:')            # DublinCore 12 - language -      @relation=text_to_match('relation:')            # DublinCore 13 - relation -      @coverage=text_to_match('coverage:')            # DublinCore 14 - coverage -      @rights=text_to_match('rights:')                # DublinCore 15 - rights -      @comment=text_to_match('comment:') -      @abstract=text_to_match('abs(?:tract)?:') -      @owner=text_to_match('owner:') -      @date_created=text_to_match('date_created:') -      @date_issued=text_to_match('date_issued:') -      @date_modified=text_to_match('date_modified:') -      @date_available=text_to_match('date_available:') -      @date_valid=text_to_match('date_valid:') -      @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date -    else -      @text1=q['s1'] if q['s1']=~/\S/ -      @keywords=q['key'] if q['key']=~/\S/ -      @title=q['ti'] if q['ti']=~/\S/ -      @author=q['au'] if q['au']=~/\S/ -      @subject=q['sj'] if q['sj']=~/\S/ -      @description=q['dsc'] if q['dsc']=~/\S/ -      @publisher=q['pb'] if q['pb']=~/\S/ -      @contributor=q['cntr'] if q['cntr']=~/\S/ -      @date=q['dt'] if q['dt']=~/\S/ -      @type=q['ty'] if q['ty']=~/\S/ -      @identifier=q['id'] if q['id']=~/\S/ -      @source=q['src'] if q['src']=~/\S/ -      @language=q['lang'] if q['lang']=~/\S/ -      @relation=q['rel'] if q['rel']=~/\S/ -      @coverage=q['cov'] if q['cov']=~/\S/ -      @rights=q['cr'] if q['cr']=~/\S/ -      @comment=q['co'] if q['co']=~/\S/ -      @abstract=q['ab'] if q['ab']=~/\S/ -      @date_created=q['dtc'] if q['dtc']=~/\S/ -      @date_issued=q['dti'] if q['dti']=~/\S/ -      @date_modified=q['dtm'] if q['dtm']=~/\S/ -      @date_available=q['dta'] if q['dta']=~/\S/ -      @date_valid=q['dtv'] if q['dtv']=~/\S/ -    end -  end -  def text_to_match(identifier='') -    m=Hash.new -    m[:string]=/#{identifier}\s*(.+?)/ -    m[:string]=/#{identifier}\s*(.+?)(?:;|\n|\r|$)/ -    m[:word]=/#{identifier}[\s(]*(\S+)/ -    search_string=if @search_field =~m[:word] -      search_string=if @search_field =~m[:braces]: m[:braces].match(@search_field)[1] -      elsif @search_field =~m[:string]:            m[:string].match(@search_field)[1] -      else -        str=m[:word].match(@search_field)[1] -        str.gsub!(/[()]/,'') -        str +    </table> +    <form action="#@base" id="Test Form" method="post"> +      <table cellpadding="2"> +      <tr><td valign=\"top\"> +          <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#@search_field</textarea> +      </td> +      <td valign=\"top\"> +        #@tip +        #@search_note +        #@the_can +      </td></tr></table> +      <td valign=\"top\"><tr><td> +        <!input type="text" id="find" name="find" value="#@search_field" /> +        <!input type="text" id="find" name="find" value="" /> +        <font size="2" color="#222222"> +        <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below) +        <br /> +        <select name="db" size="1"> +          #@selected_db +              <option value="SiSU_pace">pace</option> +              <option value="SiSU_sisu">sisu</option> +        </select> +        <input type="submit" value="SiSU search" /> +        <input type="radio" name="view" value="index" #@checked_index> index +        <input type="radio" name="view" value="text" #@checked_text> text / grep +        <br /> +          <input type="checkbox" name="echo" #@checked_echo> echo query +          <input type="checkbox" name="stats" #@checked_stats> result stats +          <input type="checkbox" name="url" #@checked_url> search url +          <input type="checkbox" name="searched" #@checked_searched> searched +          <input type="checkbox" name="tip" #@checked_tip> available fields +          <input type="checkbox" name="sql" #@checked_sql> sql statement +        <br /> +          checks: +          <input type="radio" name="checks" value="check_default" #@checked_default> default +          <input type="radio" name="checks" value="check_selected" #@checked_selected> selected +          <input type="radio" name="checks" value="check_all" #@checked_all> all +          <input type="radio" name="checks" value="check_none" #@checked_none> none +          </font> +      </td></tr> +      </table> +    </form> +      WOK +        end        end -      search_string.strip! -      search_string.gsub!(/\s+/,'+') -      search_string -    #else -    #  "__" -    end -  end -end -class Dbi_search_string -  def initialize(l,t,q) -    @l,@t,@q=l,t,q -  end -  def string -    search=Hash.new -    search[:search]=Array.new -    search[:flag]=false -    if @t =~/\S+/ or @q =~/\S+/ -      if @t =~/\S+/:     unescaped_search=CGI.unescape(@t) -      elsif @q =~/\S+/:  unescaped_search=CGI.unescape(@q) +      class Search_request                                                       #% search_for +        attr_accessor :text1,:keywords,:title,:author,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename +        def initialize(search_field='',q='') +          @search_field,@q=search_field,q +          @text1=@keywords=@title=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' +          if @search_field=~/\S/ +            @text1=text_to_match('text:') +            @keywords=text_to_match('key(?:words?)?:') +            @title=text_to_match('title:')                  # DublinCore 1  - title +            @author=text_to_match('(?:author|creator)s?:')  # DublinCore 2  - creator/author +            @subject=text_to_match('subj(?:ect)?:')         # DublinCore 3  - subject +            @description=text_to_match('description:')      # DublinCore 4  - description +            @publisher=text_to_match('pub(?:lisher)?:')     # DublinCore 5  - publisher +            @contributor=text_to_match('contributor:')      # DublinCore 6  - contributor +            @date=text_to_match('date:')                    # DublinCore 7  - date dd-mm-yy +            @type=text_to_match('type:')                    # DublinCore 8  - type +            @format=text_to_match('format:')                # DublinCore 9  - format +            @identifier=text_to_match('identifier:')        # DublinCore 10 - identifier +            @source=text_to_match('source:')                # DublinCore 11 - source +            @language=text_to_match('language:')            # DublinCore 12 - language +            @relation=text_to_match('relation:')            # DublinCore 13 - relation +            @coverage=text_to_match('coverage:')            # DublinCore 14 - coverage +            @rights=text_to_match('rights:')                # DublinCore 15 - rights +            @comment=text_to_match('comment:') +            @abstract=text_to_match('abs(?:tract)?:') +            @owner=text_to_match('owner:') +            @date_created=text_to_match('date_created:') +            @date_issued=text_to_match('date_issued:') +            @date_modified=text_to_match('date_modified:') +            @date_available=text_to_match('date_available:') +            @date_valid=text_to_match('date_valid:') +            @filename=text_to_match('filename:') +            @text1=text_to_match unless @keywords or @author or @title or @text1 or @comment or @abstract or @rights or @subject or @publisher or @date or @filename +          else +            @text1=q['s1'] if q['s1']=~/\S/ +            @keywords=q['key'] if q['key']=~/\S/ +            @title=q['ti'] if q['ti']=~/\S/ +            @author=q['au'] if q['au']=~/\S/ +            @subject=q['sj'] if q['sj']=~/\S/ +            @description=q['dsc'] if q['dsc']=~/\S/ +            @publisher=q['pb'] if q['pb']=~/\S/ +            @contributor=q['cntr'] if q['cntr']=~/\S/ +            @date=q['dt'] if q['dt']=~/\S/ +            @type=q['ty'] if q['ty']=~/\S/ +            @identifier=q['id'] if q['id']=~/\S/ +            @source=q['src'] if q['src']=~/\S/ +            @language=q['lang'] if q['lang']=~/\S/ +            @relation=q['rel'] if q['rel']=~/\S/ +            @coverage=q['cov'] if q['cov']=~/\S/ +            @rights=q['cr'] if q['cr']=~/\S/ +            @comment=q['co'] if q['co']=~/\S/ +            @abstract=q['ab'] if q['ab']=~/\S/ +            @date_created=q['dtc'] if q['dtc']=~/\S/ +            @date_issued=q['dti'] if q['dti']=~/\S/ +            @date_modified=q['dtm'] if q['dtm']=~/\S/ +            @date_available=q['dta'] if q['dta']=~/\S/ +            @date_valid=q['dtv'] if q['dtv']=~/\S/ +            @filename=q['fns'] if q['fns']=~/\S/ +            @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000 +            @@offset=q['off'] if q['off']=~/\d+/ # 0 +          end +        end +        def text_to_match(identifier='') +          m={ +            :string => /#{identifier}\s*(.+?)/, +            :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/, +            :word => /#{identifier}[\s(]*(\S+)/ +          } +          search_string=if @search_field =~m[:word] +            search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1] +            elsif @search_field =~m[:string];            m[:string].match(@search_field)[1] +            else +              str=m[:word].match(@search_field)[1] +              str.gsub!(/[()]/,'') +              str +            end +            search_string.strip! +            search_string.gsub!(/\s+/,'+') +            search_string +          #else +          #  "__" +          end +        end        end -      search_construct=Array.new -      unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #@l LIKE \( '%") -      unescaped_search.gsub!(/(.+)/,"#@l LIKE \( '%\\1%' \)") -      search_construct << unescaped_search -      search_construct=search_construct.join(' ') -      search[:search]                    << search_construct -      search[:flag]=true -      search -    end -    search -  end -end -class Dbi_search_statement -  attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format -  def initialize(conn,search_for,q) -    @conn=conn -    @text_search_flag=false -    search=Hash.new -    search[:text],search[:endnotes]=Array.new,Array.new -    st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1']).string -    se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1']).string -    @text_search_flag=st[:flag] -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << se[:search] -    end -    st=Dbi_search_string.new('metadata.keywords',search_for.keywords,q['key']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.title',search_for.title,q['ti']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.creator',search_for.author,q['au']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.subject',search_for.subject,q['sj']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.description',search_for.description,q['dsc']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.publisher',search_for.publisher,q['pb']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.contributor',search_for.contributor,q['cntr']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.date',search_for.date,q['dt']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.type',search_for.type,q['ty']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.identifier',search_for.identifier,q['id']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.source',search_for.source,q['src']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.language',search_for.language,q['lang']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.relation',search_for.relation,q['rel']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.coverage',search_for.coverage,q['cov']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.rights',search_for.rights,q['cr']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.comment',search_for.comment,q['co']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    st=Dbi_search_string.new('metadata.abstract',search_for.abstract,q['ab']).string -    if st[:flag] -      search[:text]                    << st[:search] -      search[:endnotes]                << st[:search] -    end -    @search_text,@search_endnotes=Array.new,Array.new -                                                                           #% -    search[:text].each{|x| @search_text << "#{x} AND " } -    search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } -    @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') -    @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') -  end -  def sql_select_body -    %{SELECT metadata.title, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE #{@search_text} AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, documents.ocn ;} -  end -  def sql_select_endnotes -    %{SELECT metadata.title, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE #{@search_endnotes} AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, endnotes.nr ;} -  end -  def sql_select_body_format -    %{<font color="#666666" size="2">#{sql_select_body}</font>} -  end -  def sql_select_endnotes_format -    %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} -  end -  def contents -    @conn.select_all(sql_select_body) -  end -  def endnotes -    @conn.select_all(sql_select_endnotes) -  end -end -class Tail -  def tail -    <<-'WOK' -<br /><hr /><br /> -<center><table align="center"bgcolor="#ffffff"><tr><td><font color="#666666"><table summary="" bgcolor="#ffffff" cellpadding="4" border="0" align="center"> - -<tr align="center"> -  <td align="center"><p class="center"><font color="#666666" size="2"> -  presentations' look and feel<br /> -  generated by<br /> -  <a href="http://www.jus.uio.no/sisu" ><img border="0" src="http://corundum:8081/_sisu/image/sisu.png" alt="SiSU on Debian/Gnu/Linux or a FreeBSD & Ruby - better ways, well actually, Way Better!" width="120" height="38"></a><br /> -  <a href="http://www.jus.uio.no/sisu" >SiSU</a><br /> -  version 0.36<br />2006w07/6 (20060218)<br /> - -  <table summary="SiSU rights" bgcolor="#ffffff" cellpadding="4" border="0" align="center" width="40%"> -    <sup>©</sup> Ralph Amissah<br /> -  1993, current 2007<br /> -  GPL 3<br /> -  <i>w3 since October 3 1993</i><br /> -  <a href="mailto://ralph@amissah.com" >ralph@amissah.com</a><br /> -</font></p> -</td></tr></table> - -<p><center><font color="#666666" size="2">Developed<br />using <a href="http://www.ruby-lang.org/en/">Ruby</a><br />on <a href="http://www.debian.org/">Debian/Gnu/Linux</a> software infrastructure,<br />with the usual GPL (or OSS) suspects.<br />Better - "performance, reliability, scalability, security<br />& total cost of ownership"<br />[not to mention flexibility & choice]<br /><br /><<<a href="http://www.jus.uio.no/sisu/">Way Better!</a>>></font></center></p><tr align="center"><td align="center"> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr> -  <td><p><font color="#666666" size="2"> -    If you have problems viewing pages on this site please update your browser: +      class Dbi_search_string +        def initialize(l,t,q,cse=false) +          @l,@t,@q=l,t,q +        end +        def string +          search={ :search => [],:flag => false } +          if @t =~/\S+/ or @q =~/\S+/ +            if @t =~/\S+/;     unescaped_search=CGI.unescape(@t) +            elsif @q =~/\S+/;  unescaped_search=CGI.unescape(@q) +            end +            search_construct=[] +            unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #@l LIKE \( '%") +            unescaped_search.gsub!(/(.+)/,"#@l LIKE \( '%\\1%' \)") +            search_construct << unescaped_search +            search_construct=search_construct.join(' ') +            search[:search]                    << search_construct +            search[:flag]=true +            search +          end +          search +        end +      end +      class Dbi_search_statement +        attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit +        def initialize(conn,search_for,q,c) +          @conn=conn +          @text_search_flag=false +          @sql_statement={ :body=>'',:endnotes=>'',:range=>'' } +          #@offset||=@@offset +          #@offset+=@@limit +          search={ :text => [],:endnotes => [] } +          cse=if c =~/\S/; true +          else false +          end +          st=Dbi_search_string.new('documents.clean',search_for.text1,q['s1'],cse).string +          se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string +          @text_search_flag=st[:flag] +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << se[:search] +          end +          st=Dbi_search_string.new('metadata.keywords',search_for.keywords,q['key'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.title',search_for.title,q['ti'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.creator',search_for.author,q['au'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.subject',search_for.subject,q['sj'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.description',search_for.description,q['dsc'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.publisher',search_for.publisher,q['pb'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.contributor',search_for.contributor,q['cntr'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.date',search_for.date,q['dt'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.type',search_for.type,q['ty'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.identifier',search_for.identifier,q['id'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.source',search_for.source,q['src'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.language',search_for.language,q['lang'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.relation',search_for.relation,q['rel'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.coverage',search_for.coverage,q['cov'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.rights',search_for.rights,q['cr'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.comment',search_for.comment,q['co'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.abstract',search_for.abstract,q['ab'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          st=Dbi_search_string.new('metadata.filename',search_for.filename,q['fns'],cse).string +          if st[:flag] +            search[:text]                    << st[:search] +            search[:endnotes]                << st[:search] +          end +          @@limit=q['ltd'] if q['ltd']=~/\d+/  # 1000 +          @@offset=q['off'] if q['off']=~/\d+/ # 0 +          @search_text,@search_endnotes=[],[] +                                                                                 #% +          search[:text].each{|x| @search_text << "#{x} AND " } +          @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') +          @search_text.gsub!(/(documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +          search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') +          @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +        end +        def sql_offset +          @@offset +        end +        def sql_limit +          @@limit +        end +        def sql_canned_search +          @offset_next=sql_offset.to_i + sql_limit.to_i +          @offset_previous=sql_offset.to_i - sql_limit.to_i +          def current +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + sql_offset.to_s +          end +          def next +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_next.to_s +          end +          def previous +            @offset_previous >= 0 ? (@@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : '' +          end +          def start +            @@canned_search_url.to_s + '<d=' + sql_limit.to_s + '&off=' + 0.to_s +          end +          self +        end +        def sql_canned_search_url(ok) +          if ok +            can=sql_canned_search +            page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i +            case page.to_s +            when /^1$/ +              %{<hr /><br /><center> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            when /^2$/ +              %{<hr /><br /><center> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            else +              %{<hr /><br /><center> +              <a href="#{can.start}">|<  </a> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            end +          else '' +          end +        end +        def sql_select_body +          limit ||=@@limit +          offset ||=@@offset +          @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE #{@search_text} AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} +          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} +          select=@sql_statement[:body] + ' ' + @sql_statement[:range] +          select +        end +        def sql_select_endnotes +          limit ||=@@limit +          offset ||=@@offset +          @sql_statement[:endnotes]= %{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE #{@search_endnotes} AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} +          @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} +          select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] +          select +        end +        def sql_select_body_format +          %{<font color="#666666" size="2">#{sql_select_body}</font>} +        end +        def sql_select_endnotes_format +          %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} +        end +        def contents +          @conn.select_all(sql_select_body) +        end +        def endnotes +          @conn.select_all(sql_select_endnotes) +        end +      end +      def tail +        <<-'WOK' +    <br /><hr /><br /> +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="2" border="0"> +  <!-- widget sisu --> +<tr><td valign="top" width="10%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    <a href="http://www.jus.uio.no/sisu" > +      <img border="0" src="http://localhost/sisu/_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> +    </a> +  </font></p> +</td><td valign="top" width="45%"> +<!-- SiSU Rights --> +  <p class="tiny_left"><font color="#666666" size="2"> +    Generated by +    <a href="http://www.jus.uio.no/sisu" > +      SiSU</a> 0.55.3 2007-07-10 (2007w28/2) +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +    <b>SiSU</b></a> <sup>©</sup> Ralph Amissah +    1993, current 2007. +    All Rights Reserved. +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +      SiSU</a> +    is software for document structuring, publishing and search, +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +      www.jus.uio.no/sisu +    </a> +    and +    <a href="http://www.sisudoc.org" > +      www.sisudoc.org +    </a> +  <br /> +    <i>w3 since October 3 1993</i> +    <a href="mailto://ralph@amissah.com" > +      ralph@amissah.com +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU using: +    <br />Standard SiSU markup syntax, +    <br />Standard SiSU meta-markup syntax, and the +    <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system) +  <br /> +    <sup>©</sup> Ralph Amissah 1997, current 2007. +    All Rights Reserved.    </font></p> -</td></tr></table> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="2"> -If you have problems viewing pages on this site please update your browser: -</font> -</p> -</td></tr> -</table> - -<table summary="browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/epiphany/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Epiphany"> - Epiphany -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://galeon.sourceforge.net/" target="external"> -<img border="0" width="24" height="24" src="http://corundum:8081/_sisu/image/galeon.png" alt="Galeon"> - Galeon -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.microsoft.com/windows/ie/default.asp" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/internet.explorer.png" alt="MS I-Explorer"> -I-Explorer -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://kazehakase.sourceforge.jp/" target="external"> -Kazehakase</a> -<sup>®</sup> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.konqueror.org/" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/konqueror.png" alt="Konqueror"> -Konqueror</a> -<sup>®</sup> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.mozilla.org/" target="external"> -<img border="0" width="30" height="24" src="http://corundum:8081/_sisu/image/mozilla.png" alt="Mozilla"> -Mozilla -</a> -<a href="http://www.mozilla.org/products/firefox/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/firefox.png" alt="Firefox"> -<b>Firefox</b> -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://home.netscape.com/comprod/mirror/client_download.html" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/netscape.png" alt="Netscape"> -Netscape -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.opera.com/" target="external"> -<img border="0" width="29" height="25" src="http://corundum:8081/_sisu/image/opera.png" alt="Opera"> -Opera -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.apple.com/safari/" target="external"> -<img border="0" width="24" height="25" src="http://corundum:8081/_sisu/image/safari.png" alt="Safari"> -Safari -</a> -<sup>®</sup> -</font> -</p> -</td></tr> -</table> - -<table summary="lightweight browser and text browser suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -<p> -<font color="#666666" size="1"> -for console/text viewing: -</font> -</p> -</td> -<td> -<p> -<font color="#666666" size="1"> -<a href="http://elinks.or.cz/" target="external"> -<b>elinks</b> -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> -<b>links2</b> -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://w3m.sourceforge.net/" target="external"> -<b>w3m</b> -</a> -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -for lightweight gui (X) viewing try: -</font> -</p> -</td> -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.dillo.org/" target="external"> -Dillo -</a> |</font></p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/epiphany/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Epiphany"> - Epiphany -</a> -<sup>®</sup> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://galeon.sourceforge.net/" target="external"> -<img border="0" width="24" height="24" src="http://corundum:8081/_sisu/image/galeon.png" alt="Galeon"> - Galeon -</a> | -</font> -</p> -</td> - -<td> -<p> -<font color="#666666" size="1"> -<a href="http://atrey.karlin.mff.cuni.cz/~clock/twibright/links" target="external"> -<b>links2 -g</b> -</a> -</font> -</p> -</td></tr> -</table> -</td></tr> - -<tr align="center"><td align="center"> - -<table summary="pdf viewer suggestions" bgcolor="#ffffff" cellpadding="4" border="0"> - -<tr><td> -<p class="center"> -<font color="#666666" size="1"> -& for -<a href="http://www.adobe.com/products/acrobat/adobepdf.html" target="external"> -pdf -</a> -viewings of this site we recommend stand alone viewers -<br /> -(rather than web browser plugins): -</font> -</p>  </td></tr> -</table> - -<table summary="" bgcolor="#ffffff" cellpadding="4" border="0" align="center"> -<tr align="center"><td align="center"> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.adobe.com/products/acrobat/readstep2.html" target="external"> -<img border="0" height="18" width="15" src="http://corundum:8081/_sisu/image/b_pdf.png" alt="Adobe Acrobat Reader"> -Acrobat Reader -</a> -<sup>®</sup> - | -</font> -</p> -</td> - -<td> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.gnome.org/projects/evince/" target="external"> -<img border="0" width="25" height="25" src="http://corundum:8081/_sisu/image/gnome.png" alt="Evince"> -<b>Evince</b> -</a> -<sup>®</sup> -</font> -</p> -</td> - -<td> -<p class="center"><font color="#666666" size="1"> -<a href="http://www.cs.wisc.edu/~ghost/gv/" target="external"> - GhostView<sup>®</sup> </a>, -<a href="http://wwwthep.physik.uni-mainz.de/~plass/gv/" target="external"> -GV<sup>®</sup> -</a> -& -<a href="http://www.cs.wisc.edu/~ghost/gsview/" target="external"> -GSview<sup>®</sup> -</a> - | -</font> -</p> -</td> - -<td> -<p class="center"> -<font color="#666666" size="1"> -<a href="http://www.foolabs.com/xpdf/" target="external"> -<img border="0" width="16" height="16" src="http://corundum:8081/_sisu/image/xpdf.png" alt="Xpdf"> - Xpdf -</a> -<sup>®</sup> -</font> -</p> +  <!-- widget way better --> +<tr><td valign="top" width="10%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    <a href="http://www.gnu.org/licenses/gpl.html"> +      <img border="0" src="http://localhost/sisu/_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU is released under +    <a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a> +    or later, +    <a href="http://www.gnu.org/licenses/gpl.html"> +      http://www.gnu.org/licenses/gpl.html +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU, developed using +    <a href="http://www.ruby-lang.org/en/"> +      Ruby +    </a> +    on +    <a href="http://www.debian.org/"> +      Debian/Gnu/Linux +    </a> +    software infrastructure, +    with the usual GPL (or OSS) suspects. +  <br /> +    Better - "performance, reliability, scalability, security & total cost of ownership" +    [not to mention flexibility & choice] +  <br /> +    Get With the Future +    <a href="http://www.jus.uio.no/sisu/"> +      Way Better! +    </a> +  </font></p>  </td></tr>  </table> - -</font></center></td></tr></table></center> <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a> -</body></html> -WOK -  end -end -@counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 -@counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','','' -FCGI.each_cgi do |cgi| -  begin # all code goes in begin section -    @search=Hash.new -    @search[:text],@search[:endnotes]=Array.new,Array.new -    q=CGI.new -    @db=if cgi['db'] =~/\S+/: -      @stub=/SiSU_(\S+)/.match(cgi['db'])[1] -      cgi['db'] -    else -      @stub='sisu' -      'SiSU_sisu' -    end -    checked_url,checked_searched,checked_tip,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,selected_db='','','','','','','','' -    if cgi['view']=~/text/: checked_index,checked_text='','checked' -    else                    checked_index,checked_text='checked','' -    end -    checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 -    checked_searched='checked' if cgi['searched'] =~/\S/ -    checked_tip='checked' if cgi['tip'] =~/\S/ -    checked_echo='checked' if cgi['echo'] =~/\S/ -    checked_sql='checked' if cgi['sql'] =~/\S/ -    if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 -      checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' -      checked_none='' -    elsif cgi['checks'] =~/check_none/ #or cgi['a'].to_i==0 -      checked_none='checked' -      checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' -    else checked_ignore='checked' -    end -    selected_db=case cgi['db'] -     when /SiSU_document_samples_sisu_markup/: '<option value="SiSU_document_samples_sisu_markup">document_samples_sisu_markup</option>' -     when /SiSU_sisu/: '<option value="SiSU_sisu">sisu</option>' -    end -    db_name='sisu_sqlite.db' -    db_sqlite=case cgi['db'] -    when /SiSU_document_samples_sisu_markup/:                      "/home/ralph/sisu_www/document_samples_sisu_markup/sisu_sqlite.db" -    when /SiSU_sisu/:                      "/home/ralph/sisu_www/sisu/sisu_sqlite.db" -    end -    @dbi="DBI:SQLite:#{db_sqlite}" #sqlite3 ? -    @conn=DBI.connect(@dbi) -    search_field=cgi['find'] if cgi['find'] # =~/\S+/ -    @search_for=Search_request.new(search_field,q) #.analyze               #% search_for -                                                                           #% searches -    #Canned_search.new(@base,@search_for.text1,cgi) -    if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ -      s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ -      key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ -      ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ -      au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ -      sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ -      dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ -      pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ -      cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ -      dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ -      ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ -      id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ -      src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ -      lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ -      rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ -      cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ -      cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ -      co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ -      ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ -      dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ -      dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ -      dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ -      dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ -      dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ -      canned_search_url=if checked_all =~/checked/ -        "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" -      else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}&db=#{cgi['db']}&view=#{cgi['view']}&u=1&e=1" +    <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a> +    </body></html> +    WOK        end -      @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 -      @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 -      canned_note='previous search url:' -    else -      canned_search_url="#@base?s1=United+Nations&db=documents&view=index" -      canned_note='search url example:' -    end -    if search_field =~/\S+/ -      analyze_format=search_field.gsub(/\s*\n/,'; ') -    elsif checked_all =~/checked/ or checked_url =~/checked/ -      canned_search=canned_search_url.scan(/(?:s1|au|ti)=[^&]+/) -      af=canned_search.join('; ') -      af.gsub!(/s1=/,'text: ') -      af.gsub!(/au=/,'author: ') -      af.gsub!(/ti=/,'title: ') -      af.gsub!(/%2B/,' ') -      analyze_format=af -      st=af.split(/\s*;\s*/) -      search_field=st.join("\n") -    end -    green=%{<font size="2" color="#004000">} -    the_can=%{<font size="2" color="#666666">#{canned_note}<br> <a href="#{canned_search_url}">#{canned_search_url}</a></font><br>} -    p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject='' -    p_text=%{text: #{green}#{@search_for.text1}</font><br>} if @search_for.text1 =~/\S+/ -    p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br>} if @search_for.keywords =~/\S+/ -    p_title=%{title: #{green}#{@search_for.title}</font><br>} if @search_for.title =~/\S+/ -    p_author=%{author: #{green}#{@search_for.author}</font><br>} if @search_for.author =~/\S+/ -    p_subject=%{subject: #{green}#{@search_for.subject}</font><br>} if @search_for.subject =~/\S+/ -    p_description=%{description: #{green}#{@search_for.description}</font><br>} if @search_for.description =~/\S+/ -    p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br>} if @search_for.publisher =~/\S+/ -    p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br>} if @search_for.contributor =~/\S+/ -    p_date=%{date: #{green}#{@search_for.date}</font><br>} if @search_for.date =~/\S+/ -    p_type=%{type: #{green}#{@search_for.type}</font><br>} if @search_for.type =~/\S+/ -    p_format=%{format: #{green}#{@search_for.format}</font><br>} if @search_for.format =~/\S+/ -    p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br>} if @search_for.identifier =~/\S+/ -    p_source=%{source: #{green}#{@search_for.source}</font><br>} if @search_for.source =~/\S+/ -    p_language=%{language: #{green}#{@search_for.language}</font><br>} if @search_for.language =~/\S+/ -    p_relation=%{relation: #{green}#{@search_for.relation}</font><br>} if @search_for.relation =~/\S+/ -    p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br>} if @search_for.coverage =~/\S+/ -    p_rights=%{rights: #{green}#{@search_for.rights}</font><br>} if @search_for.rights =~/\S+/ -    p_comment=%{comment: #{green}#{@search_for.comment}</font><br>} if @search_for.comment =~/\S+/ -    p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br>} if @search_for.abstract =~/\S+/ -    search_note=<<-WOK -<font size="2" color="#666666"> -<br><b>previous selection</b>:<br> -database: #{green}#@db</font>; selected view: #{green}#{cgi['view']}</font><br> -search string: "#{green}#{analyze_format}</font>"<br> -#{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} -</font> -WOK -    #eg = %{canned search e.g.:<br> <a href="#{url}">#{url}</a><br>find: #{analyze}<br>database: #{database}} -    #dbi_canning -    @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can).submission_form #% form -    @tail=Tail.new.tail -    unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ -      print "Content-type: text/html\n\n" -      puts (@header+@tail) -    else #% searches -      s1=if @search_for.text1 =~/\S/ -        @search_for.text1 -      else 'Unavailable' -      end -      @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} -      @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} -    #dbi_request -      dbi_statement=Dbi_search_statement.new(@conn,@search_for,q) -      @text_search_flag=false -      @text_search_flag=dbi_statement.text_search_flag -      s_contents=dbi_statement.contents -      s_endnotes=dbi_statement.endnotes -      @body_main=Array.new -      @endnotes=Array.new -      oldtid=0 -      if @text_search_flag -        if checked_sql =~/\S/ -          sql_select_body=dbi_statement.sql_select_body_format -          sql_select_endnotes=dbi_statement.sql_select_endnotes_format -        else sql_select_body,sql_select_endnotes='','' -        end -        @body_main << "<p><hr><br><b>Main Text:</b><br>" << sql_select_body -        @endnotes  << "<p><hr><br><b>Endnotes:</b><br>"  << sql_select_endnotes -      else -      end -      #text_objects_body -      s_contents.each do |c|                                               #% text body -        location=c["filename"][/(.+?)\.ss[ftm]/, 1] -        file_suffix=c["filename"][/.+?\.(ss[ftm])/, 1] -      #metadata_found_body -        if c["tid"].to_i != oldtid.to_i -          title=%{<a href="#@hosturl/#@stub/#{location}/">#{c["title"]}</a> by #{c["creator"]} <a href="#@hosturl/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@url_base/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@url_base/b_pdf.png" alt="pdf landscape"></a><br>}  if file_suffix=~/s/ #hmm watch file_suffix -           if @text_search_flag: title='<br><hr>'+title -           else                  title='<br>'+title -           end -           @counter_txt_doc+=1 -           oldtid=c["tid"].to_i -          else                    title='' -          end -          if @text_search_flag -            if cgi['view']=~/text/                                         #% txt body -              text=if c["suffix"] !~/1/ #seg -                if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! -                  if @search_for.text1 =~/\S+/:     unescaped_search=CGI.unescape(@search_for.text1) -                  elsif q['s1'] =~/\S+/:           unescaped_search=CGI.unescape(q['s1']) +      @tail=tail +      @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 +      @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','','' +      FCGI.each_cgi do |cgi| +        begin # all code goes in begin section +          @search={ :text => [],:endnotes => [] } +          q=CGI.new +          @db=if cgi['db'] =~/\S+/; +            @stub=/SiSU_(\S+)/.match(cgi['db'])[1] +            cgi['db'] +          else +            @stub='sisu' +            'SiSU_sisu' +          end +          checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' +          if cgi['view']=~/text/; checked_index,checked_text='','checked' +          else                    checked_index,checked_text='checked','' +          end +          checked_echo='checked' if cgi['echo'] =~/\S/ +          checked_stats='checked' if cgi['stats'] =~/\S/ +          checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 +          checked_searched='checked' if cgi['searched'] =~/\S/ +          checked_tip='checked' if cgi['tip'] =~/\S/ +          checked_case='checked' if cgi['casesense'] =~/\S/ +          checked_sql='checked' if cgi['sql'] =~/\S/ +          if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 +            checked_all='checked' +            checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' +            checked_none='' +          elsif cgi['checks'] =~/check_none/ +            checked_none='checked' +            checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' +          elsif cgi['checks'] =~/check_selected/ +            checked_selected='checked' +          elsif cgi['checks'] =~/check_default/ +            checked_default='checked' +            checked_echo=checked_stats=checked_url='checked' +            checked_searched=checked_tip=checked_case=checked_sql='' +          else +            checked_selected='checked' +            checked_echo=checked_stats=checked_url='checked' +            checked_searched=checked_tip=checked_case=checked_sql='' +          end +          selected_db=case cgi['db'] +           when /SiSU_pace/; '<option value="SiSU_pace">pace</option>' +           when /SiSU_sisu/; '<option value="SiSU_sisu">sisu</option>' +          end +          db_name='sisu_sqlite.db' +          db_sqlite=case cgi['db'] +          when /SiSU_pace/;                      "/home/ralph/sisu_www/pace/sisu_sqlite.db" +          when /SiSU_sisu/;                      "/home/ralph/sisu_www/sisu/sisu_sqlite.db" +          end +          @dbi="DBI:SQLite:#{db_sqlite}" #sqlite3 ? +          @conn=DBI.connect(@dbi) +          search_field=cgi['find'] if cgi['find'] # =~/\S+/ +          @search_for=Search_request.new(search_field,q) #.analyze               #% search_for +                                                                                 #% searches +          #Canned_search.new(@base,@search_for.text1,cgi) +          if @search_for.text1=~/\S+/ or @search_for.author=~/\S+/ #and search_field =~/\S/ +            s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/ +            key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/ +            ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/ +            au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/ +            sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ +            dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ +            pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ +            cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ +            dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ +            ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ +            id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/ +            src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/ +            lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/ +            rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/ +            cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/ +            cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/ +            co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/ +            ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/ +            dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/ +            dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/ +            dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/ +            dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/ +            dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ +            fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ +            @@canned_search_url=if checked_all =~/checked/ +              "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" +            else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" +            end +            @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" +            if checked_case=~/\S/ +              @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 +              @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 +            else +              @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 +              @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 +            end +            canned_note='search url:' +          else +            @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" +            canned_note='search url example:' +          end +          if search_field =~/\S+/ +            analyze_format=search_field.gsub(/\s*\n/,'; ') +          elsif checked_all =~/checked/ or checked_url =~/checked/ +            canned_search=@@canned_search_url.scan(/(?:s1|au|ti|fns)=[^&]+/) +            af=canned_search.join('; ') +            af.gsub!(/s1=/,'text: ') +            af.gsub!(/au=/,'author: ') +            af.gsub!(/ti=/,'title: ') +            af.gsub!(/fns=/,'filename: ') +            af.gsub!(/%2B/,' ') +            analyze_format=af +            st=af.split(/\s*;\s*/) +            search_field=st.join("\n") +          end +          green=%{<font size="2" color="#004000">} +          canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) +          the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />} +          p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject=p_filename='' +          p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/ +          p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br />} if @search_for.keywords =~/\S+/ +          p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/ +          p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/ +          p_subject=%{subject: #{green}#{@search_for.subject}</font><br />} if @search_for.subject =~/\S+/ +          p_description=%{description: #{green}#{@search_for.description}</font><br />} if @search_for.description =~/\S+/ +          p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br />} if @search_for.publisher =~/\S+/ +          p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/ +          p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/ +          p_type=%{type: #{green}#{@search_for.type}</font><br />} if @search_for.type =~/\S+/ +          p_format=%{format: #{green}#{@search_for.format}</font><br />} if @search_for.format =~/\S+/ +          p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br />} if @search_for.identifier =~/\S+/ +          p_source=%{source: #{green}#{@search_for.source}</font><br />} if @search_for.source =~/\S+/ +          p_language=%{language: #{green}#{@search_for.language}</font><br />} if @search_for.language =~/\S+/ +          p_relation=%{relation: #{green}#{@search_for.relation}</font><br />} if @search_for.relation =~/\S+/ +          p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br />} if @search_for.coverage =~/\S+/ +          p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/ +          p_comment=%{comment: #{green}#{@search_for.comment}</font><br />} if @search_for.comment =~/\S+/ +          p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br />} if @search_for.abstract =~/\S+/ +          p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/ +          search_note=<<-WOK +      <font size="2" color="#666666"> +      <b>database:</b> #{green}#@db</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> +      <b>search string:</b> "#{green}#{analyze_format}</font>"<br /> +      #{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} +      </font> +      WOK +          #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} +          #dbi_canning +          @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form +          unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ +            print "Content-type: text/html\n\n" +            puts (@header+@tail) +          else #% searches +            s1=if @search_for.text1 =~/\S/ +              @search_for.text1 +            else 'Unavailable' +            end +            if checked_case=~/\S/ +              @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} +              @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} +            else +              @search[:text]<<%{documents.clean~*'#{CGI.unescape(s1)}'} +              @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} +            end +          #dbi_request +            dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case) +            @text_search_flag=false +            @text_search_flag=dbi_statement.text_search_flag +            s_contents=dbi_statement.contents +            s_endnotes=dbi_statement.endnotes +            @body_main,@endnotes=[],[] +            @search_regx=nil +            oldtid=0 +            if @text_search_flag +              if checked_sql =~/\S/ +                sql_select_body=dbi_statement.sql_select_body_format +                sql_select_endnotes=dbi_statement.sql_select_endnotes_format +              else sql_select_body,sql_select_endnotes='','' +              end +              @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body +              @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes +            else +            end +            #text_objects_body +            s_contents.each do |c|                                               #% text body +              location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +              file_suffix=c['filename'][/.+?\.(_?sst|ssm)$/,1] +              lang=if location =~ /\S+?~(\S\S\S?)$/ +                l=location[/\S+?~(\S\S\S?)$/,1] +                location.gsub!(/(\S+?)~\S\S\S?/,'\1') +                l=".#{l}" +              else '' +              end +            #metadata_found_body +              if c['tid'].to_i != oldtid.to_i +                ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" +                else c['title'] +                end +                can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                end +                title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix +                if @text_search_flag; title='<br /><hr>'+title +                else                  title='<br />'+title +                end +                @counter_txt_doc+=1 +                oldtid=c['tid'].to_i +              else                    title='' +              end +              if @text_search_flag +                if cgi['view']=~/text/                                         #% txt body +                  text=if c['suffix'] !~/1/ #seg +                    if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! +                      unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) +                      elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1']) +                      else nil +                      end +                      @search_regx=if unescaped_search                                     #check +                        search_regex=[] +                        build=unescaped_search.scan(/\S+/).each do |g| +                           if g.to_s =~/(AND|OR)/ +                             search_regex << '|' +                           else search_regex << %{#{g.to_s}} +                           end +                        end +                        search_regex=search_regex.join(' ') +                        search_regex=search_regex.gsub(/\s*\|\s*/,'|') +                        Regexp.new(search_regex, Regexp::IGNORECASE) +                      else nil +                      end +                    else nil +                    end +                    matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                      matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                    else c['body'] +                    end +                    %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} +                  elsif c['suffix'] =~/1/ #doc +                    %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} +                  end +                  @counter_txt_ocn+=1 +                  output=if c['seg'] =~/\S+/; title+text +                  else                        text                    end -                  search_regex=Array.new -                  build=unescaped_search.scan(/\S+/).each do |g| -                     if g.to_s =~/(AND|OR)/ -                       search_regex << '|' -                     else search_regex << %{#{g.to_s}} -                     end +                elsif cgi['view']=~/index/                                     #% idx body +                  if c['suffix'] !~/1/ #seg +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag +                  elsif c['suffix'] =~/1/ #doc +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                  end +                  if c['seg'] =~/\S+/ +                    if @text_search_flag +                      @counter_txt_ocn+=1 +                      output=title+index +                    end +                  else +                    @counter_txt_ocn+=1 +                    output=unless c['suffix'] =~/1/; title+index +                    else %{#{title}#{c['ocn'].sort}, } +                    end                    end -                  search_regex=search_regex.join(' ') -                  search_regex=search_regex.gsub(/\s*\|\s*/,'|') -                  @search_regx=search_regex.to_s                  end -                matched_para=c["body"].gsub(/(#@search_regx)/i,%{<span style="background-color: #ffff48">\\1</span>}) -                %{<hr><p><font size="2">ocn <b><a href="#@hosturl/#@stub/#{location}/#{c["seg"]}.html##{c["ocn"]}">#{c["ocn"]}</a></b>:</font></p>#{matched_para}} -              elsif c["suffix"] =~/1/ #doc -                %{#{title}<hr><p><font size="2">ocn #{c["ocn"]}:#{c["body"]}} +              else output=title                end -              @counter_txt_ocn+=1 -              output=if c["seg"] =~/\S+/: title+text -              else                        text +              @counters_txt=if @counter_txt_doc > 0 +                if checked_stats =~/\S/ +                  @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                  %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />} +                else '' +                end +              else ''                end -            elsif cgi['view']=~/index/                                     #% idx body -              if c["suffix"] !~/1/ #seg -                index=%{<a href="#@hosturl/#@stub/#{location}/#{c["seg"]}.html##{c["ocn"]}">#{c["ocn"]}</a>, } if @text_search_flag -              elsif c["suffix"] =~/1/ #doc -                index=%{<a href="#@hosturl/#@stub/#{location}/doc.html##{c["ocn"]}">#{c["ocn"]}</a>, } +              @body_main << output #+ details +            end +            #text_objects_endnote +            oldtid = 0 +            s_endnotes.each do |e|                                               #% endnotes +              location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +              file_suffix=e['filename'][/.+?\.(_?sst|ssm)$/,1] +              lang=if location =~ /\S+?~(\S\S\S?)$/ +                l=location[/\S+?~(\S\S\S?)$/,1] +                location.gsub!(/(\S+?)~\S\S\S?/,'\1') +                l=".#{l}" +              else ''                end -              if c["seg"] =~/\S+/ -                if @text_search_flag -                  @counter_txt_ocn+=1 -                  output=title+index +            #metadata_found_endnotes +              if @text_search_flag +                if e['metadata_tid'].to_i != oldtid.to_i +                  ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" +                  else e['title'] +                  end +                  can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  end +                  title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ +                  @counter_endn_doc+=1 +                  oldtid=e['metadata_tid'].to_i +                else title = '' +                end +                if cgi['view']=~/text/                                           #% txt endnotes +                  @counter_endn_ocn+=1 +                  matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                    matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                  else e['body'] +                  end +                  output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} +                elsif cgi['view']=~/index/                                       #% idx endnotes +                  @counter_endn_ocn+=1 +                  output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], }                  end -              else -                @counter_txt_ocn+=1 -                output=unless c["suffix"] =~/1/: title+index -                else %{#{title}#{c["ocn"].sort}, } +                @counters_endn=if @counter_endn_doc > 0 +                  if checked_stats =~/\S/ +                  @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                    %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.</font><br />} +                  else '' +                  end                  end +                @endnotes << output #+ details +              else @endnotes=[] #does not take out yet                end              end -          else output=title +            offset=dbi_statement.sql_offset.to_s +            limit=dbi_statement.sql_limit.to_s +            @@lt_t ||=false; @@lt_e ||=false +            canned=if (@@lt_t or @@lt_e) +              dbi_statement.sql_canned_search_url(true).to_s +            else +              dbi_statement.sql_canned_search_url(false).to_s +            end +            limit=dbi_statement.sql_limit.to_s +            cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes            end -        @counters_txt=if @counter_txt_doc > 0 -          %{<font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.</font><br />} -        else '' -        end -        @body_main << output #+ details -      end -      #text_objects_endnote -      oldtid = 0 -      s_endnotes.each do |e|                                               #% endnotes -        location=e["filename"][/(.+?)\.ss[ftm]/, 1] -        file_suffix=e["filename"][/.+?\.(ss[ftm])/, 1] -      #metadata_found_endnotes -        if @text_search_flag -          if e["metadata_tid"].to_i != oldtid.to_i -            title=%{<br><hr><a href="#@hosturl/#@stub/#{location}/">#{e["title"]}</a> by #{e["creator"]} <a href="#@hosturl/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@url_base/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@url_base/b_pdf.png" alt="pdf landscape"></a><br>}  if file_suffix=~/s/ -            @counter_endn_doc+=1 -            oldtid=e["metadata_tid"].to_i -          else title = '' -          end -          if cgi['view']=~/text/                                           #% txt endnotes -            @counter_endn_ocn+=1 -            matched_endnote=e["body"].gsub(/(#@search_regx)/i,%{<span style="background-color: #ffff48">\\1</span>}) -            output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl/#@stub/#{location}/endnotes.html##{e["nr"]}">#{e["nr"]}</a></b> referred to from ocn <a href="#@hosturl/#@stub/#{location}/doc.html##{e["ocn"]}">#{e["ocn"]}</a>:</font> #{matched_endnote}} -          elsif cgi['view']=~/index/                                       #% idx endnotes -            @counter_endn_ocn+=1 -            output=%{#{title}<a href="#@hosturl/#@stub/#{location}/endnotes.html#_#{e["nr"]}">#{e["nr"]}</a> [§ <a href="#@hosturl/#@stub/#{location}/doc.html##{e["ocn"]}">#{e["ocn"]}</a>], } -          end -          @counters_endn=if @counter_endn_doc > 0 -          %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.</font><br />} -          end -          @endnotes << output #+ details -        else @endnotes=Array.new #does not take out yet +        rescue Exception => e +          s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) +          s << CGI::escapeHTML(e.message) + '</pre>' +          cgi.out{s} +          next +        ensure # eg. disconnect from server +          @conn.disconnect if @conn          end        end -      cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + @tail} #% print cgi_output_header+counters+body+endnotes -    end -  rescue Exception => e -    s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) -    s << CGI::escapeHTML(e.message) + '</pre>' -    cgi.out{s} -    next -  ensure # eg. disconnect from server -    @conn.disconnect if @conn -  end -end diff --git a/data/sisu/conf/syntax/README b/data/sisu/conf/editor-syntax-etc/README index 82d5ff67..9fde1d1e 100644 --- a/data/sisu/conf/syntax/README +++ b/data/sisu/conf/editor-syntax-etc/README @@ -3,15 +3,15 @@ This directory    /usr/share/sisu-examples/sisu-examples/config/syntax_hi  contains rudimentary sisu syntax highlighting files for: -* (g)vim http://www.vim.org +* (g)vim <http://www.vim.org>    * package: sisu-vim    * status: largely done    * comments: not found here      a vim syntax highlighting and folds component of sisu exists,      see sisu-vim -* gedit http://www.gnome.org/projects/gedit -* gobby http://gobby.0x539.de/ +* gedit <http://www.gnome.org/projects/gedit> +* gobby <http://gobby.0x539.de/>    file: sisu.lang    place in:      /usr/share/gtksourceview-1.0/language-specs @@ -20,7 +20,7 @@ contains rudimentary sisu syntax highlighting files for:    * status: very basic syntax highlighting    * comments: this editor features display line wrap and is used by Goby! -* nano http://www.nano-editor.org +* nano <http://www.nano-editor.org>    file: nanorc    save as:      ~/.nanorc @@ -30,7 +30,7 @@ contains rudimentary sisu syntax highlighting files for:      no display line-wrap      does line breaks -* diakonos (an editor written in ruby) http://purepistos.net/diakonos +* diakonos (an editor written in ruby) <http://purepistos.net/diakonos>    file: diakonos.conf    save as:      ~/.diakonos/diakonos.conf @@ -48,22 +48,22 @@ contains rudimentary sisu syntax highlighting files for:    [settings::configure kate::{highlighting,filetypes}]    [tools::highlighting::{markup,scripts}::SiSU] -* nedit http://www.nedit.org +* nedit <http://www.nedit.org>    file: sisu_nedit.pats    nedit -import sisu_nedit.pats    * status: a very clumsy first attempt    [not really done]    * comments: this editor features display line wrap -* emacs http://www.gnu.org/software/emacs/emacs.html +* emacs <http://www.gnu.org/software/emacs/emacs.html>    files: sisu-mode.el    to file ~/.emacs add the following 2 lines:      (add-to-list 'load-path "/usr/share/sisu-examples/config/syntax_hi")      (require 'sisu-mode.el)    [not done / not yet included] -* vim & gvim http://www.vim.org -  files: sisu-vim http://www.jus.uio.no/sisu/SiSU/download +* vim & gvim <http://www.vim.org> +  files: sisu-vim <http://www.jus.uio.no/sisu/SiSU/download>    package is the most comprehensive sisu syntax highlighting and editor    environment provided to date (is for vim/ gvim, and is separate from the    contents of this directory) diff --git a/data/sisu/conf/syntax/diakonos.conf b/data/sisu/conf/editor-syntax-etc/diakonos/diakonos.conf index f40547bc..c7fa686b 100644 --- a/data/sisu/conf/syntax/diakonos.conf +++ b/data/sisu/conf/editor-syntax-etc/diakonos/diakonos.conf @@ -931,34 +931,32 @@ lang.sisu.tokens.heading.format yellow bold  #lang.sisu.tokens.heading.format white inverse  lang.sisu.tokens.headings.case_insensitive ^(?:Chapter|Part|Section|Book|Article|Preamble|Appendix)\s.*  lang.sisu.tokens.headings.format white bold -lang.sisu.tokens.bullet ^_[12]?\*\s+ +lang.sisu.tokens.bullet ^_[1-9]?\*\s+  lang.sisu.tokens.bullet.format yellow -lang.sisu.tokens.indent ^_[12]\s+ +lang.sisu.tokens.indent ^_[1-9]\s+  lang.sisu.tokens.indent.format yellow -lang.sisu.tokens.link \{.+?\}(?:http:\/\/\S+|image) -lang.sisu.tokens.link.format yellow -lang.sisu.tokens.url http:\/\/\S+ +lang.sisu.tokens.link \{.+?\}(?:https?://\S+|\.\./\S+|image) +lang.sisu.tokens.link.format cyan +lang.sisu.tokens.url http://\S+  lang.sisu.tokens.url.format blue bold  lang.sisu.tokens.line_bold ^!_\s+.*  lang.sisu.tokens.line_bold.format white bold -lang.sisu.tokens.font_bold [!*]\{.+?\}[!*] +lang.sisu.tokens.font_bold (([!*])\{.+?\}\2)  lang.sisu.tokens.font_bold.format white bold -lang.sisu.tokens.font_modify [/_+-^,]\{.+?\}[/_+-^,] +lang.sisu.tokens.font_modify (([/_^,+-])\{.+?\}\2)  lang.sisu.tokens.font_modify.format brown  lang.sisu.tokens.page_break <:(?:pb|np)>  lang.sisu.tokens.page_break.format white bold inverse -lang.sisu.tokens.br <(?:\/\s*)?br> +lang.sisu.tokens.br <:?br>  lang.sisu.tokens.br.format white bold inverse  lang.sisu.tokens.endnote_mark ~\^(?:\s|$)  lang.sisu.tokens.endnote_mark.format green  lang.sisu.tokens.endnote_content ^\^~\s.+  lang.sisu.tokens.endnote_content.format green - -lang.sisu.tokens.endnote.open ~\{ -lang.sisu.tokens.endnote.close \}~ -lang.sisu.tokens.endnote.format green -#lang.sisu.tokens.endnotes ~\{.+?\}~ -#lang.sisu.tokens.endnotes.format green +#lang.sisu.tokens.endnote.open ~\{ +#lang.sisu.tokens.endnote.close \}~ +lang.sisu.tokens.endnotes ~\{.+?\}~ +lang.sisu.tokens.endnotes.format green  lang.sisu.tokens.group.open ^group\{  lang.sisu.tokens.group.close ^\}group  lang.sisu.tokens.group.format green @@ -968,9 +966,9 @@ lang.sisu.tokens.poem.format green  lang.sisu.tokens.code.open ^code\{  lang.sisu.tokens.code.close ^\}code  lang.sisu.tokens.code.format green - -lang.sisu.tokens.error [a-zA-Z0-9,.::?!&]+http:\/\/\S+ -lang.sisu.tokens.error.format magenta +lang.sisu.tokens.error \s+$|<\S{2}\S+?>|[a-zA-Z0-9,.::?!&><]+http://\S+|http://\S+< +#lang.sisu.tokens.error \s+$|<\S+?>|[a-zA-Z0-9,.::?!&><]+http://\S+|http://\S+< +lang.sisu.tokens.error.format magenta reverse  # Custom configuration files can be included.  # If a setting is specified again, it overrides the previous setting given diff --git a/data/sisu/conf/syntax/sisu.lang b/data/sisu/conf/editor-syntax-etc/gedit/sisu.lang index 4fcd9b68..b11766cb 100644 --- a/data/sisu/conf/syntax/sisu.lang +++ b/data/sisu/conf/editor-syntax-etc/gedit/sisu.lang @@ -17,7 +17,7 @@ or:  	</pattern-item>    <pattern-item _name="Operators" style="Function"> -    <regex>^(!_|_[12]|_[12]?\*)\s</regex> +    <regex>^(!_|_[1-9]|_[1-9]?\*)\s</regex>  	</pattern-item>  	<syntax-item _name="Note Function" style="Function"> @@ -26,13 +26,43 @@ or:  	</syntax-item>  	<syntax-item _name="Bold Function" style="Function"> -    <start-regex>[!*]\{</start-regex> -    <end-regex>\}[!*]</end-regex> +    <start-regex>[*]\{</start-regex> +    <end-regex>\}[*]</end-regex>  	</syntax-item> -	<syntax-item _name="FontFace Function" style="Function"> -    <start-regex>[/_,^+-]\{</start-regex> -    <end-regex>\}[/_,^+-]</end-regex> +	<syntax-item _name="Exclaim Function" style="Function"> +    <start-regex>!\{</start-regex> +    <end-regex>\}!</end-regex> +	</syntax-item> + +	<syntax-item _name="Italics Function" style="Function"> +    <start-regex>/\{</start-regex> +    <end-regex>\}/</end-regex> +	</syntax-item> + +	<syntax-item _name="Underscore Function" style="Function"> +    <start-regex>_\{</start-regex> +    <end-regex>\}_</end-regex> +	</syntax-item> + +	<syntax-item _name="Supercript Function" style="Function"> +    <start-regex>\^{</start-regex> +    <end-regex>\}\^</end-regex> +	</syntax-item> + +	<syntax-item _name="Subscript Function" style="Function"> +    <start-regex>,{</start-regex> +    <end-regex>\},</end-regex> +	</syntax-item> + +	<syntax-item _name="Added Function" style="Function"> +    <start-regex>[+]\{</start-regex> +    <end-regex>\}[+]</end-regex> +	</syntax-item> + +	<syntax-item _name="Strikethrough Function" style="Function"> +    <start-regex>[-]\{</start-regex> +    <end-regex>\}[-]</end-regex>  	</syntax-item>    <pattern-item _name="Bold Single" style="String"> @@ -40,11 +70,15 @@ or:  	</pattern-item>    <pattern-item _name="Link" style="String"> -    <regex>\{[^}]+\}(http:\/\/\S+|image)\s</regex> +    <regex>\{[^}]+\}(https?:\/\/\S+|image)\s</regex> +	</pattern-item> + +  <pattern-item _name="Link Internal" style="String"> +    <regex>\s\*~\S+</regex>  	</pattern-item>  	<pattern-item _name="Url" style="String"> -    <regex>\bhttp:\/\/\S+</regex> +    <regex>\bhttps?:\/\/\S+</regex>  	</pattern-item>  	<line-comment _name="Line Comment" style="Comment"> @@ -76,7 +110,7 @@ or:  	</pattern-item>  	<pattern-item _name="Line Break" style="Others 2" end-at-line-end = "TRUE"> -    <regex><(\/\s*)?br></regex> +    <regex><:?br></regex>  	</pattern-item>  	<pattern-item _name="Footnote Reference" style="Others" end-at-line-end = "TRUE"> diff --git a/data/sisu/conf/syntax/sisu.xml b/data/sisu/conf/editor-syntax-etc/kate/sisu.xml index 61135285..61135285 100644 --- a/data/sisu/conf/syntax/sisu.xml +++ b/data/sisu/conf/editor-syntax-etc/kate/sisu.xml diff --git a/data/sisu/conf/syntax/nanorc b/data/sisu/conf/editor-syntax-etc/nano/nanorc index 213a0c26..213a0c26 100644 --- a/data/sisu/conf/syntax/nanorc +++ b/data/sisu/conf/editor-syntax-etc/nano/nanorc diff --git a/data/sisu/conf/syntax/sisu_nedit.pats b/data/sisu/conf/editor-syntax-etc/nedit/sisu_nedit.pats index e60e0bf0..e60e0bf0 100644 --- a/data/sisu/conf/syntax/sisu_nedit.pats +++ b/data/sisu/conf/editor-syntax-etc/nedit/sisu_nedit.pats diff --git a/data/sisu/conf/vim/addons/colors/slate.vim b/data/sisu/conf/editor-syntax-etc/vim/addons/colors/slate.vim index 8350017e..8350017e 100644 --- a/data/sisu/conf/vim/addons/colors/slate.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/addons/colors/slate.vim diff --git a/data/sisu/conf/vim/addons/filetype.vim b/data/sisu/conf/editor-syntax-etc/vim/addons/filetype.vim index 917c3e04..917c3e04 100644 --- a/data/sisu/conf/vim/addons/filetype.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/addons/filetype.vim diff --git a/data/sisu/conf/vim/addons/ftplugin/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/addons/ftplugin/sisu.vim index 00ed9189..00ed9189 100644 --- a/data/sisu/conf/vim/addons/ftplugin/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/addons/ftplugin/sisu.vim diff --git a/data/sisu/conf/vim/addons/syntax/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/addons/syntax/sisu.vim index 8a114b64..8a114b64 100644 --- a/data/sisu/conf/vim/addons/syntax/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/addons/syntax/sisu.vim diff --git a/data/sisu/conf/syntax/sisu-mode.el b/data/sisu/conf/syntax/sisu-mode.el deleted file mode 100644 index 6fcfcb3d..00000000 --- a/data/sisu/conf/syntax/sisu-mode.el +++ /dev/null @@ -1,235 +0,0 @@ -;;; sisu-mode.el.el --- Major mode for editing .sisu-files - -;;; It mainly defines a grammar for syntax highlighting. -;;; SiSU http://www.jus.uio.no/sisu - -;;; Copyright 2005 Ralph Amissah - -;;; Author: Ralph Amissah <ralph.amissah@gmail.com> -;;; Version: $Id$ -;;; Keywords: perl sisu - -;;; This program is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3, or (at your option) -;;; any later version. -;;; -;;; This program is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with this program; if not, write to the Free Software -;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: - -;;; This mode is built with help of the -;;; "Emacs language mode creation tutorial" at -;;; http://two-wugs.net/emacs/mode-tutorial.html -;;; -;;; Regexes are defined for the following font-lock-faces: -;;; -;;;   font-lock-keyword-face -;;;   font-lock-type-face -;;;   font-lock-comment-face -;;;   font-lock-reference-face -;;;   font-lock-doc-string-face -;;;   font-lock-function-name-face -;;; - -;;; Usage: - -;;; Put this file into your load-path and the following into your ~/.emacs: -;;; -;;;    (require 'sisu-mode.el) -;;; -;;; -;;; To associate sisu-mode.el with .s[tmi] files add the following to your ~/.emacs -;;; -;;;    (setq auto-mode-alist -;;;       (append auto-mode-alist -;;;         '(("\\.ss[tmi]$" . sisu-mode.el)))) -;;; -;;; -;;; To automatically turn on font-lock-mode add the following to your ~/.emacs -;;; -;;;    (add-hook 'sisu-mode.el-hook 'font-lock-mode) -;;; -;;; Code: - -;; ;; default variables -;; (defvar sisu-mode.el-hook nil) -;; -;; (defvar sisu-mode-map -;;   (let ((sisu-mode-map (make-keymap))) -;;     (define-key wpdl-mode-map "\C-j" 'newline-and-indent) -;;     sisu-mode-map) -;;   "Keymap for SiSU major mode") -;; -;; (add-to-list 'auto-mode-alist '("\\.ss[tmi]\\'" . sisu-mode)) - -(defvar sisu-mode-hook nil) - -(defvar sisu-mode-map -  (let ((sisu-mode-map (make-keymap))) -    (define-key sisu-mode-map "\C-j" 'newline-and-indent) -    sisu-mode-map) -  "Keymap for SiSU major mode") -(add-to-list 'auto-mode-alist '("\\.ss[tmi]\\'" . sisu-mode)) - -(defconst sisu-font-lock-keywords-1 -  (list -   '("\\<\\(BOOK\\|CHAPTER\\).+" . font-lock-builtin-face) -;   '("\\<\\(BOOK\\|CHAPTER\\)\\>" . font-lock-builtin-face) -   '("\\('\\w*'\\)" . font-lock-variable-name-face)) -  "Minimal highlighting expressions for SiSU mode") - -(defconst sisu-font-lock-keywords-2 -  (append sisu-font-lock-keywords-1 -		  (list -; header -		   '("^0~.+" . font-lock-keyword-face) -; heading -		   '("^[1-6]~.+" . font-lock-keyword-face) -; bullet -		   '("\\<\\(_\\*\\|_[12]\\|_\\*[12]\\) " . font-lock-constant-face) -; font, bold italics etc. -		   '("^!_ .+" . font-lock-constant-face) -		   '("[/_+-^,]{.+?}[/_+-^,]" . font-lock-constant-face) -		   '("[!*]{.+?}[!*]" . font-lock-constant-face) -; endnotes -		   '("~{.+?}~" . font-lock-constant-face) -		   '("~\\^(\s\\|$)" . font-lock-constant-face) -		   '("^\\^~\s.+" . font-lock-constant-face) -; links -		   '("{.+?}http://[^ \n]+" . font-lock-constant-face) -		   '("http://[^ \n]+" . font-lock-constant-face) -; breaks -		   '("<:\\(pb\\|np\\)>" . font-lock-constant-face) -		   '("<\\(\s*/\\)?br>" . font-lock-constant-face) -; comments -		   '("[a-zA-Z0-9,.::?!&]+http://[^ \n]+" . font-lock-constant-face) -		   '("^%+ .+" . font-lock-constant-face) -; errors -       '("[a-zA-Z0-9,.::?!&]+http://[^ \n]+" . font-lock-constant-face) -; not done -; multiline matches !! -; poem code group alt -		   '("^code{.+?}code" . font-lock-constant-face) -;		   '("\\http://[a-zA-Z0-9]+" . font-lock-constant-face) -;		   '("\\<\\(\\_\\*\\|\\_[12]\\|\\_\\*[12]\\) \\>" . font-lock-constant-face) -; select more appropriate matches -      )) -  "Additional Keywords to highlight in SiSU mode") - - (defconst sisu-font-lock-keywords-3 -   (append sisu-font-lock-keywords-2 - 		  (list -; 		  '("\\<\\(0~\\|[1-6]~\\|!_ \\)\\>" . font-lock-constant-face) -      )) -   "Balls-out highlighting in SiSU mode") - -(defvar sisu-font-lock-keywords sisu-font-lock-keywords-3 -  "Default highlighting expressions for SiSU mode") - - (defvar sisu-mode-syntax-table -   (let ((sisu-mode-syntax-table (make-syntax-table))) -     (modify-syntax-entry ?_ "w" sisu-mode-syntax-table) -;     (modify-syntax-entry ?/ ". 124b" sisu-mode-syntax-table) -     (modify-syntax-entry ?* ". 23" sisu-mode-syntax-table) -     (modify-syntax-entry ?\n "> b" sisu-mode-syntax-table) -    sisu-mode-syntax-table) -  "Syntax table for sisu-mode") - -(defun sisu-mode () -  "Major mode for editing Workflow Process Description Language files" -  (interactive) -  (kill-all-local-variables) -  (set-syntax-table sisu-mode-syntax-table) -  (use-local-map sisu-mode-map) - -(set (make-local-variable 'font-lock-defaults) '(sisu-font-lock-keywords)) -(setq major-mode 'sisu-mode) -(setq mode-name "SiSU") -(run-hooks 'sisu-mode-hook)) -(provide 'sisu-mode.el) - -;; ;; keymap -;; (defvar sisu-mode.el-map nil "Keymap for SiSU major mode.") -;; (if sisu-mode.el-map nil -;;   (let ((map (make-sparse-keymap))) -;;     ;; insert (define-key map ...) stuff here -;;     (setq sisu-mode.el-map map))) -;; -;; syntax highlighting: standard keywords -;; (defconst sisu-font-lock-keywords-1 -;;   '( -;;     ("^\\(!_\\|_[12]\\|_*\\)" 0 font-lock-keyword-face) -;;     ("^_[12]\\(.*\\)$" 1 font-lock-type-face) -;; ;;   ("^[ \t]+\\(.*\\)$" 1 font-lock-type-face) -;;     ) -;;   "Minimal highlighting expressions for SiSU mode.") -;; -;; ;; syntax highlighting: additional keywords -;; (defconst sisu-font-lock-keywords-2 -;;   (append sisu-font-lock-keywords-1 -;; 	  '( -;; 	    ("%+ \\(.*\\)" 2 font-lock-comment-face) -;; 	    )) -;;   "Additional Keywords to highlight in SiSU mode.") -;; -;; ;; syntax highlighting: even more keywords -;; (defconst sisu-font-lock-keywords-3 -;;   (append sisu-font-lock-keywords-2 -;; 	  '( -;; 	    ("^0~.+" 1 font-lock-reference-face) -;; 	    ("^[1-6]~.+" 2 font-lock-reference-face) -;; ;;	    ("[IBSCF]<\\([^>]*\\)>" 1 font-lock-reference-face) -;; ;;	    ("L<\\([^|>]*|\\)?\\([^>]+\\)>" 2 font-lock-reference-face) -;; 	    ("L<\\([^|>]*\\)|\\([^>]*\\)>" 1 font-lock-doc-string-face) -;; 	    ("E<\\([^>]*\\)>" 1 font-lock-function-name-face) -;; 	    ("\"\\([^\"]+\\)\"" 0 font-lock-string-face) -;; 	    )) -;;   "Balls-out highlighting in SiSU mode.") -;; -;; ;; default level of highlight to maximum -;; (defvar sisu-font-lock-keywords sisu-font-lock-keywords-3 -;;   "Default highlighting expressions for SiSU mode") -;; -;; ;; no special indenting, just pure text mode -;; (defun sisu-indent-line () -;;   "Indent current line as SiSU code. Does nothing yet." -;;   (interactive) -;;   ) -;; -;; ;; no special syntax table -;; (defvar sisu-mode.el-syntax-table nil -;;   "Syntax table for sisu-mode.el.") -;; -;; ;; create and activate syntax table -;; (defun sisu-create-syntax-table () -;;   (if sisu-mode.el-syntax-table -;;       () -;;     (setq sisu-mode.el-syntax-table (make-syntax-table)) -;;     (set-syntax-table sisu-mode.el-syntax-table) -;;     )) - -;; main -; (defun sisu-mode.el () -;   "Major mode for editing SiSU files." -;   (interactive) -;   (kill-all-local-variables) -;   (sisu-create-syntax-table) -;   (use-local-map sisu-mode.el-map) -;   (make-local-variable 'font-lock-defaults) -;   (setq font-lock-defaults '(sisu-font-lock-keywords 't)) -;   ;; (make-local-variable 'indent-line-function) -;   ;; (setq indent-line-function 'sisu-indent-line) -;   (setq major-mode 'sisu-mode.el) -;   (setq mode-name "SiSU") -;   (run-hooks 'sisu-mode.el-hook)) - - -;;; sisu-mode.el ends here diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index 9a577337..b3a7a82b 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -185,7 +185,7 @@ module  SiSU_CGI_pgsql          def sql_select_body            limit ||=@@limit            offset ||=@@offset -          @sql_statement[:body]=%{SELECT metadata.title, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} +          @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn}            @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}            select=@sql_statement[:body] + ' ' + @sql_statement[:range]            select @@ -193,7 +193,7 @@ module  SiSU_CGI_pgsql          def sql_select_endnotes            limit ||=@@limit            offset ||=@@offset -          @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} +          @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr}            @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}            select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]            select diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index fbb627db..6239b6bf 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -174,7 +174,7 @@ module SiSU_CGI_sql      <form action="#@base" id="Test Form" method="post">        <table cellpadding="2">        <tr><td valign=\"top\"> -          <textarea id="find" name="find" type="text" rows="4" cols="30" maxlength="256">#@search_field</textarea> +          <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#@search_field</textarea>        </td>        <td valign=\"top\">          #@tip @@ -451,28 +451,31 @@ module SiSU_CGI_sql            end            self          end -        def sql_canned_search_url -          can=sql_canned_search -          page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i -          case page.to_s -          when /^1$/ -            %{<hr /><br /><center> -            pg. #{page.to_s} -            <a href="#{can.next}">  ></a> -            </center>} -          when /^2$/ -            %{<hr /><br /><center> -            <a href="#{can.previous}"><  </a> -            pg. #{page.to_s} -            <a href="#{can.next}">  ></a> -            </center>} -          else -            %{<hr /><br /><center> -            <a href="#{can.start}">|<  </a> -            <a href="#{can.previous}"><  </a> -            pg. #{page.to_s} -            <a href="#{can.next}">  ></a> -            </center>} +        def sql_canned_search_url(ok) +          if ok +            can=sql_canned_search +            page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i +            case page.to_s +            when /^1$/ +              %{<hr /><br /><center> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            when /^2$/ +              %{<hr /><br /><center> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            else +              %{<hr /><br /><center> +              <a href="#{can.start}">|<  </a> +              <a href="#{can.previous}"><  </a> +              pg. #{page.to_s} +              <a href="#{can.next}">  ></a> +              </center>} +            end +          else ''            end          end        WOK_SQL @@ -483,51 +486,7 @@ module SiSU_CGI_sql        def tail          <<-'WOK'      <br /><hr /><br /> -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> -  <!-- widget way better --> -<tr><td valign="top" width="10%"> -  <p class="tiny_left"><font color="#666666" size="2"> - -    <a href="http://www.gnu.org/licenses/gpl.html"> -      <img border="0" src="#@image_src/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> -    </a> -  </font></p> -</td><td valign="top" width="45%"> -  <p class="tiny_left"><font color="#666666" size="2"> -    <b>SiSU</b> <sup>©</sup> Ralph Amissah -    1993, current 2007 -    All Rights Reserved. -  <br /> -    <b>SiSU is released under -    <a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a> -    or later</b> -    <a href="http://www.gnu.org/licenses/gpl.html"> -      http://www.gnu.org/licenses/gpl.html -    </a> -  </font></p> -</td><td valign="top" width="45%"> -  <p class="tiny_left"><font color="#666666" size="2"> -    Developed using -    <a href="http://www.ruby-lang.org/en/"> -      Ruby -    </a> -    on -    <a href="http://www.debian.org/"> -      Debian/Gnu/Linux -    </a> -    software infrastructure, -    & with the usual GPL (or OSS) suspects. -  <br /> -    Better - "performance, reliability, scalability, security & total cost of ownership" -    [not to mention flexibility & choice] -  <br /> -    Get With the Future -    <a href="http://www.jus.uio.no/sisu/"> -      Way Better! -    </a> -  </font></p> -</td></tr> +<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="2" border="0">    <!-- widget sisu -->  <tr><td valign="top" width="10%">    <p class="tiny_left"><font color="#666666" size="2"> @@ -540,9 +499,16 @@ module SiSU_CGI_sql    <p class="tiny_left"><font color="#666666" size="2">      Generated by      <a href="http://www.jus.uio.no/sisu" > -      SiSU -    </a> -    #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) +      #{v[:project]}</a> #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +    <b>#{v[:project]}</b></a> <sup>©</sup> Ralph Amissah +    1993, current 2007. +    All Rights Reserved. +    <br /> +    <a href="http://www.jus.uio.no/sisu" > +      #{v[:project]}</a> +    is software for document structuring, publishing and search,      <br />      <a href="http://www.jus.uio.no/sisu" >        www.jus.uio.no/sisu @@ -552,7 +518,6 @@ module SiSU_CGI_sql        www.sisudoc.org      </a>    <br /> -  <br />      <i>w3 since October 3 1993</i>      <a href="mailto://ralph@amissah.com" >        ralph@amissah.com @@ -560,7 +525,7 @@ module SiSU_CGI_sql    </font></p>  </td><td valign="top" width="45%">    <p class="tiny_left"><font color="#666666" size="2"> -    Using: +    #{v[:project]} using:      <br />Standard SiSU markup syntax,      <br />Standard SiSU meta-markup syntax, and the      <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system) @@ -569,6 +534,44 @@ module SiSU_CGI_sql      All Rights Reserved.    </font></p>  </td></tr> +  <!-- widget way better --> +<tr><td valign="top" width="10%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    <a href="http://www.gnu.org/licenses/gpl.html"> +      <img border="0" src="#@image_src/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    SiSU is released under +    <a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a> +    or later, +    <a href="http://www.gnu.org/licenses/gpl.html"> +      http://www.gnu.org/licenses/gpl.html +    </a> +  </font></p> +</td><td valign="top" width="45%"> +  <p class="tiny_left"><font color="#666666" size="2"> +    #{v[:project]}, developed using +    <a href="http://www.ruby-lang.org/en/"> +      Ruby +    </a> +    on +    <a href="http://www.debian.org/"> +      Debian/Gnu/Linux +    </a> +    software infrastructure, +    with the usual GPL (or OSS) suspects. +  <br /> +    Better - "performance, reliability, scalability, security & total cost of ownership" +    [not to mention flexibility & choice] +  <br /> +    Get With the Future +    <a href="http://www.jus.uio.no/sisu/"> +      Way Better! +    </a> +  </font></p> +</td></tr>  </table>      <a name="bottom" id="bottom"></a><a name="down" id="down"></a><a name="end" id="end"></a><a name="finish" id="finish"></a><a name="stop" id="stop"></a><a name="credits" id="credits"></a>      </body></html> @@ -658,6 +661,7 @@ module SiSU_CGI_sql                "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1"              else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}"              end +            @canned_base_url="#@base?#{s1}&db=#{cgi['db']}"              if checked_case=~/\S/                @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1                @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 @@ -764,75 +768,85 @@ module SiSU_CGI_sql                end              #metadata_found_body                if c['tid'].to_i != oldtid.to_i -                title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{c['title']}</a></span> by #{c['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix -                 if @text_search_flag; title='<br /><hr>'+title -                 else                  title='<br />'+title -                 end -                 @counter_txt_doc+=1 -                 oldtid=c['tid'].to_i -                else                    title='' +                ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" +                else c['title']                  end -                if @text_search_flag -                  if cgi['view']=~/text/                                         #% txt body -                    text=if c['suffix'] !~/1/ #seg -                      if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! -                        unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) -                        elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1']) -                        else nil -                        end -                        @search_regx=if unescaped_search                                     #check -                          search_regex=[] -                          build=unescaped_search.scan(/\S+/).each do |g| -                             if g.to_s =~/(AND|OR)/ -                               search_regex << '|' -                             else search_regex << %{#{g.to_s}} -                             end -                          end -                          search_regex=search_regex.join(' ') -                          search_regex=search_regex.gsub(/\s*\|\s*/,'|') -                          search_regex.to_s -                        else nil -                        end +                can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                end +                title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix +                if @text_search_flag; title='<br /><hr>'+title +                else                  title='<br />'+title +                end +                @counter_txt_doc+=1 +                oldtid=c['tid'].to_i +              else                    title='' +              end +              if @text_search_flag +                if cgi['view']=~/text/                                         #% txt body +                  text=if c['suffix'] !~/1/ #seg +                    if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! +                      unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) +                      elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1'])                        else nil                        end -                      matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) -                        matched=if c['body'] =~/<a href="https?:\/\//mi; c['body'] -                        else (c['body'].gsub(/(#@search_regx)/i,%{<span style="background-color: #@color_match">\\1</span>})) +                      @search_regx=if unescaped_search                                     #check +                        search_regex=[] +                        build=unescaped_search.scan(/\S+/).each do |g| +                           if g.to_s =~/(AND|OR)/ +                             search_regex << '|' +                           else search_regex << %{#{g.to_s}} +                           end                          end -                        matched -                      else c['body'] +                        search_regex=search_regex.join(' ') +                        search_regex=search_regex.gsub(/\s*\|\s*/,'|') +                        Regexp.new(search_regex, Regexp::IGNORECASE) +                      else nil                        end -                      %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} -                    elsif c['suffix'] =~/1/ #doc -                      %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} -                    end -                    @counter_txt_ocn+=1 -                    output=if c['seg'] =~/\S+/; title+text -                    else                        text +                    else nil                      end -                  elsif cgi['view']=~/index/                                     #% idx body -                    if c['suffix'] !~/1/ #seg -                      index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag -                    elsif c['suffix'] =~/1/ #doc -                      index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                    matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                      matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                    else c['body']                      end -                    if c['seg'] =~/\S+/ -                      if @text_search_flag -                        @counter_txt_ocn+=1 -                        output=title+index -                      end -                    else +                    %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} +                  elsif c['suffix'] =~/1/ #doc +                    %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} +                  end +                  @counter_txt_ocn+=1 +                  output=if c['seg'] =~/\S+/; title+text +                  else                        text +                  end +                elsif cgi['view']=~/index/                                     #% idx body +                  if c['suffix'] !~/1/ #seg +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag +                  elsif c['suffix'] =~/1/ #doc +                    index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                  end +                  if c['seg'] =~/\S+/ +                    if @text_search_flag                        @counter_txt_ocn+=1 -                      output=unless c['suffix'] =~/1/; title+index -                      else %{#{title}#{c['ocn'].sort}, } -                      end +                      output=title+index +                    end +                  else +                    @counter_txt_ocn+=1 +                    output=unless c['suffix'] =~/1/; title+index +                    else %{#{title}#{c['ocn'].sort}, }                      end                    end -                else output=title                  end +              else output=title +              end                @counters_txt=if @counter_txt_doc > 0                  if checked_stats =~/\S/ -                  %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.</font><br />} +                  @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                  %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />}                  else ''                  end                else '' @@ -853,7 +867,13 @@ module SiSU_CGI_sql              #metadata_found_endnotes                if @text_search_flag                  if e['metadata_tid'].to_i != oldtid.to_i -                  title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{e['title']}</a></span> by #{e['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ +                  ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" +                  else e['title'] +                  end +                  can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                  end +                  title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/                    @counter_endn_doc+=1                    oldtid=e['metadata_tid'].to_i                  else title = '' @@ -861,21 +881,24 @@ module SiSU_CGI_sql                  if cgi['view']=~/text/                                           #% txt endnotes                    @counter_endn_ocn+=1                    matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) -                    matched=if e['body'] =~/<a href="https?:\/\//mi; e['body'] -                    else e['body'].gsub(/(#@search_regx)/i,%{<span style="background-color: #@color_match">\\1</span>}) -                      #e['body'] -                    end -                    matched +                    matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>})                    else e['body']                    end -                  output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html##{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} +                  output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}                  elsif cgi['view']=~/index/                                       #% idx endnotes                    @counter_endn_ocn+=1                    output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], }                  end                  @counters_endn=if @counter_endn_doc > 0                    if checked_stats =~/\S/ -                    %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.</font><br />} +                  @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i +                    over='over' +                    true +                  else +                    over='' +                    false +                  end +                    %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.</font><br />}                    else ''                    end                  end @@ -885,7 +908,12 @@ module SiSU_CGI_sql              end              offset=dbi_statement.sql_offset.to_s              limit=dbi_statement.sql_limit.to_s -            canned=dbi_statement.sql_canned_search_url.to_s +            @@lt_t ||=false; @@lt_e ||=false +            canned=if (@@lt_t or @@lt_e) +              dbi_statement.sql_canned_search_url(true).to_s +            else +              dbi_statement.sql_canned_search_url(false).to_s +            end              limit=dbi_statement.sql_limit.to_s              cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes            end diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index 56b1e588..7a8bfe41 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -175,7 +175,7 @@ module  SiSU_CGI_sqlite          def sql_select_body            limit ||=@@limit            offset ||=@@offset -          @sql_statement[:body]=%{SELECT metadata.title, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE #{@search_text} AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} +          @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE #{@search_text} AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn}            @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}            select=@sql_statement[:body] + ' ' + @sql_statement[:range]            select @@ -183,7 +183,7 @@ module  SiSU_CGI_sqlite          def sql_select_endnotes            limit ||=@@limit            offset ||=@@offset -          @sql_statement[:endnotes]= %{SELECT metadata.title, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE #{@search_endnotes} AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} +          @sql_statement[:endnotes]= %{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE #{@search_endnotes} AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr}            @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}            select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]            select diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index e6c4184a..251d5b58 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -113,7 +113,7 @@ module SiSU_Concordance          @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home -->"></a>}          @lnk=lnk          @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><p align="justify"><font size="3" color="#000000" face="times new roman"><a href="#{@md.fn[:manifest]}" #{@vz.js_toc}><img border="0" height="12" width="12" src="../_sisu/image/bullet_red.png" alt="Manifest"> <b>#{@md.title}</b></a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:toc]}" #{@vz.js_toc}><img border="0" height="15" width="15" src="../_sisu/image/b_toc.png" alt="TOC"> TOC - table of contents for individual articles</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:doc]}" #{@vz.js_doc}><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> Full text (with indexed table of contents)</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:pdf_p]}" #{@vz.js_portrait}><img border="0" height="18" width="15" src="../_sisu/image/b_pdf.png" alt="PDF portrait"> pdf version of the document (portrait)</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:pdf_l]}" #{@vz.js_landscape}><img border="0" height="15" width="18" src="../_sisu/image/b_pdf.png" alt="PDF landscape"> pdf version of the document (landscape)</a></font></p> </td></tr></table><p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br />[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><p align="justify"><font size="3" color="#000000" face="times new roman"><a href="#{@md.fn[:manifest]}" #{@vz.js_toc}><img border="0" height="12" width="12" src="../_sisu/image/b_info.png" alt="Manifest"> <b>#{@md.dc_title}</b></a><br />    #{@md.dc_creator}</font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:toc]}" #{@vz.js_toc}><img border="0" height="15" width="15" src="../_sisu/image/b_toc.png" alt="TOC"> TOC - table of contents for individual articles</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:doc]}" #{@vz.js_doc}><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> Full text (with indexed table of contents)</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:pdf_p]}" #{@vz.js_portrait}><img border="0" height="18" width="15" src="../_sisu/image/b_pdf.png" alt="PDF portrait"> pdf version of the document (portrait)</a></font></p><p><font size="3" color="#000000" face="times new roman">            <a href="#{@md.fn[:pdf_l]}" #{@vz.js_landscape}><img border="0" height="15" width="18" src="../_sisu/image/b_pdf.png" alt="PDF landscape"> pdf version of the document (landscape)</a></font></p> </td></tr></table><p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br />[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p>  WOK        end        def create diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 1148ab63..b9528063 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -63,6 +63,7 @@ module SiSU_DB_import      include SiSU_Param      include SiSU_Screen      @@dl=nil +    @@hname=nil      attr_accessor :tp      def initialize(opt,conn='',sql_type='pg')        @opt,@conn,@sql_type=opt,conn,sql_type @@ -381,7 +382,7 @@ module SiSU_DB_import                  @en_pls << txt.scan(/~\[[+](\d+).+?\]~/)                  txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>')                end -              @col[:body]=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:lev]).lev4_minus +              @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_minus                special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                strip_markup(@col[:plaintext]) @@ -405,25 +406,31 @@ module SiSU_DB_import                @col[:lv4]+=1                @col[:lid]+=1                @col[:lev]=4 +              @hname=if @col[:seg] and not @col[:seg].to_s.empty? +                @@hname=@col[:seg].to_s +              else @@hname +              end +              @env=SiSU_Env::Info_env.new(@md.fns) +              @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"                if txt =~ /~\{.+?\}~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') +                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\*.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\+.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end -              @col[:body]=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:lev],@col[:seg]).lev4_plus +              @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                strip_markup(@col[:plaintext]) @@ -445,25 +452,31 @@ module SiSU_DB_import                @col[:lv5]+=1                @col[:lid]+=1                @col[:lev]=5 +              @hname=if @col[:seg] and not @col[:seg].to_s.empty? +                @@hname=@col[:seg].to_s +              else @@hname +              end +              @env=SiSU_Env::Info_env.new(@md.fns) +              @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"                if txt =~ /~\{.+?\}~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') +                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\*.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\+.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end -              @col[:body]=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:lev],@col[:seg]).lev4_plus +              @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                strip_markup(@col[:plaintext]) @@ -485,25 +498,31 @@ module SiSU_DB_import                @col[:lv6]+=1                @col[:lid]+=1                @col[:lev]=6 +              @hname=if @col[:seg] and not @col[:seg].to_s.empty? +                @@hname=@col[:seg].to_s +              else @@hname +              end +              @env=SiSU_Env::Info_env.new(@md.fns) +              @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"                if txt =~ /~\{.+?\}~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') +                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\*.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\+.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end -              @col[:body]=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:lev],@col[:seg]).lev4_plus +              @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                strip_markup(@col[:plaintext]) @@ -520,24 +539,30 @@ module SiSU_DB_import                @col[:lid]+=1                txt=''                txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/m).match(data).captures +              @hname=if @col[:seg] and not @col[:seg].to_s.empty? +                 @@hname=@col[:seg].to_s +              else @@hname +              end +              @env=SiSU_Env::Info_env.new(@md.fns) +              @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"                if txt =~ /~\{.+?\}~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') +                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                  #txt.gsub!(/~\{(\d+).+?\}~/,'^[\1]') # remove endnote, keep endnote reference number, display as, e.g. [^1]                end                if txt =~/~\[\*.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if txt =~/~\[\+.+?\]~/                  word_mode=txt.scan(/\S+/)                  endnote_range(word_mode)                  @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>})                end                if @sql_type=~/pg/ and txt.size > (document_clean - 1)             #% examine pg build & remove limitation                  puts "\n\nTOO LARGE (TXT - see error log)\n\n" @@ -553,13 +578,13 @@ module SiSU_DB_import                if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last                end                @col[:body]=if txt=~/<!T[h]?¡.+?!~\d+;\w\d+;\w\d+>/ #watch -                SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns]).html_table +                SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).html_table                elsif txt=~/<:i1>/ -                SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns]).indent1 +                SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent1                elsif txt=~/<:i2>/ -                SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns]).indent2 +                SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent2                else -                SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns]).norm +                SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).norm                end                special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup @@ -578,7 +603,7 @@ module SiSU_DB_import                      en,txt,digest_clean=$1,$2,$3                    end                    @id_n+=1 -                  body=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns],en).endnote +                  body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,en).endnote                    special_character_escape(body)                    special_character_escape(txt)                    strip_markup(txt) @@ -607,7 +632,7 @@ module SiSU_DB_import                      en,txt,digest_clean=$1,$2,$3                    end                    @id_n+=1 -                  body=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns],en).endnote +                  body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,en).endnote                    special_character_escape(body)                    special_character_escape(txt)                    strip_markup(txt) @@ -636,7 +661,7 @@ module SiSU_DB_import                      en,txt,digest_clean=$1,$2,$3                    end                    @id_n+=1 -                  body=SiSU_Format_Shared::CSS_Format.new(txt,@col[:ocn],@col[:ocnd],@col[:ocns],en).endnote +                  body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,en).endnote                    special_character_escape(body)                    special_character_escape(txt)                    strip_markup(txt) diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 694b2e83..6585e700 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -67,7 +67,7 @@ module SiSU_Viz        #@css=SiSU_Env::CSS_default.new        @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'        @dir=SiSU_Env::Info_env.new -      @date=SiSU_Env::Info_date.new +      @date=SiSU_Env::Info_date.new #{@date.year}      end      #% glyph      def glyph_bullet # • @@ -770,7 +770,7 @@ module SiSU_Viz        %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_bluebell}" alt="Contents" />}      end      def png_manifest -      %{<img border="0" height="12" width="12" src="#{url_path_image}/#{icon_manifest}" alt="Document Manifest" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_manifest}" alt="Document Manifest" />}      end      def png_doc        %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_doc}" alt="Full Text" />} @@ -1306,7 +1306,6 @@ WOK  WOK      end      def widget_sisu -      #{@date.year}        v=SiSU_Env::Info_version.new.get_version  <<WOK  <!-- widget sisu --> @@ -1319,11 +1318,23 @@ WOK  </td><td valign="top" width="45%">  <!-- SiSU Rights -->    <p class="tiny_left"><font color="#666666" size="2"> -    Generated by +    Output generated by      <a href="#{url_sisu}" #{js_sisu}> -      SiSU +      #{v[:project]}      </a> -    #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) +    #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) +    <br /> +    <a href="#{url_sisu}" #{js_sisu}> +      <b>#{v[:project]}</b> +    </a> +    <sup>©</sup> Ralph Amissah. +    1997, current  #{@date.year_static}. +    All Rights Reserved. +    <br /> +    <a href="#{url_sisu}" #{js_sisu}> +      #{v[:project]} +    </a> +    is software for document structuring, publishing and search,      <br />      <a href="#{url_sisu}" #{js_sisu}>        www.jus.uio.no/sisu @@ -1333,7 +1344,6 @@ WOK        www.sisudoc.org      </a>    <br /> -  <br />      <i>w3 since October 3 1993</i>      <a href="mailto://ralph@amissah.com" #{js_mail}>        ralph@amissah.com @@ -1341,18 +1351,19 @@ WOK    </font></p>  </td><td valign="top" width="45%">    <p class="tiny_left"><font color="#666666" size="2"> -    Using: +    #{v[:project]} using:      <br />Standard SiSU markup syntax,      <br />Standard SiSU meta-markup syntax, and the      <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system)    <br /> -    <sup>©</sup> Ralph Amissah 1997, current 2007. +    <sup>©</sup> Ralph Amissah 1997, current #{@date.year_static}.      All Rights Reserved.    </font></p>  </td></tr>  WOK      end      def widget_way_better +      v=SiSU_Env::Info_version.new.get_version        <<WOK  <!-- widget way better -->  <tr><td valign="top" width="10%"> @@ -1363,20 +1374,19 @@ WOK    </font></p>  </td><td valign="top" width="45%">    <p class="tiny_left"><font color="#666666" size="2"> -    <b>SiSU</b> <sup>©</sup> Ralph Amissah -    1993, current 2007 -    All Rights Reserved. -  <br /> -    <b>SiSU is released under -    <a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a> -    or later</b> +    <a href="#{url_sisu}" #{js_sisu}> +      #{v[:project]} +    </a> +    is released under +    <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> +    or later,      <a href="http://www.gnu.org/licenses/gpl.html">        http://www.gnu.org/licenses/gpl.html      </a>    </font></p>  </td><td valign="top" width="45%">    <p class="tiny_left"><font color="#666666" size="2"> -    Developed using +    #{v[:project]}, developed using      <a href="http://www.ruby-lang.org/en/">        Ruby      </a> @@ -1385,7 +1395,7 @@ WOK        Debian/Gnu/Linux      </a>      software infrastructure, -    & with the usual GPL (or OSS) suspects. +    with the usual GPL (or OSS) suspects.    <br />      Better - "performance, reliability, scalability, security & total cost of ownership"      [not to mention flexibility & choice] @@ -1425,8 +1435,8 @@ WOK      def credits_sisu        %{#{widgets_open}  <tr><td> -  #{widget_way_better}    #{widget_sisu} +  #{widget_way_better}  </table>}      end      def credits_splash @@ -1484,8 +1494,7 @@ documents, books, digital libraries in plaintext, html, XHTML, XML,  ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and  for search</title>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<meta name="dc.title" content= -"SiSU information Structuring Universe, Structured information Serialised Units, 2007" /> +<meta name="dc.title" content="SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" />  <meta name="dc.creator" content="Ralph Amissah" />  <meta name="dc.subject" content=  "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> @@ -1512,7 +1521,7 @@ for search</title>    Structured information, Serialized Units  </h2>  <h2 class="top_band_tiny"> -software for electronic texts, document collections, books, digital libraries, and search +software for electronic texts, document collections, books, digital libraries, and search,  </h2>  <h2 class="top_band_tiny">   with "atomic search" and text positioning system (shared text citation numbering: "<i>ocn</i>") @@ -1846,7 +1855,7 @@ ralph.amissah@gmail.com  </a>  </p>  <p class="small"> -2007 +#{@date.year_static}  </p>  <p class="tiny">  w3 since October 3 1993 diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 442f2b19..cbbcadb4 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -839,7 +839,6 @@ WOK      Endnotes    </h4>  #{@vz.table_close} -#{table_top_control}  <h1>Endnotes</h1>}      end      def navigation_table diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 1221f1f1..96eb0bee 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -190,8 +190,8 @@ module SiSU_HTML_seg      def header_art(para)        format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md)        if para =~/^[0-6]~/ #2004w27/5 -        if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next #if format_head_seg.dot_control_pre_next -        else                          @@seg[:dot_nav]=format_head_seg.dot_control_pre #if format_head_seg.dot_control_pre +        if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next +        else                          @@seg[:dot_nav]=format_head_seg.dot_control_pre          end        end        ads=SiSU_HTML_promo::Ad.new(@md) diff --git a/lib/sisu/v0/i18n.rb b/lib/sisu/v0/i18n.rb index a3908119..07204fb7 100644 --- a/lib/sisu/v0/i18n.rb +++ b/lib/sisu/v0/i18n.rb @@ -461,7 +461,7 @@ module SiSU_Translate        'Document Language Versions, manifests'      end      def manifest_description_output -      'SiSU manifest of generated output' +      'SiSU manifest'      end      def manifest_description_metadata        'SiSU manifest of document metadata' diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 193d9c7e..931ea96b 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -476,6 +476,7 @@ SiSU manifest: #{@md.title}  <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">  #{banner_table}  <h1 class="small">#{@md.dc_title}</h1> +<p class="bold">#{@md.dc_creator}</p>  <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">  WOK            published_versions diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 5285b6db..76def67d 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -60,18 +60,29 @@ module SiSU_Format_Shared    include SiSU_Viz    class CSS_Format      require "#{SiSU_lib}/defaults" -    def initialize(content=nil,id=nil,ocnd='',ocns='',lv='',hname=nil) +    @@fns=nil +    def initialize(md,content=nil,col=nil,en=nil)        content.gsub!(/<:i[12]>/,'') -      @content=content -      @id=@ocn=id -      @ocnd,@ocns=ocnd,ocns -      @lv=@notenumber=lv.to_s -      @hname=hname.to_s +      @md,@content=md,content +      @id=@ocn=col[:id] +      @ocnd,@ocns=col[:ocnd],col[:ocns] +      @notenumber=en +      @lv=col[:lev].to_s +      @@hname=if @md.fns != @@fns +        @@fns=@md.fns +        '' +      end +      @hname=if col[:seg] and not col[:seg].to_s.empty? +        @@hname=col[:seg].to_s +      else @@hname +      end        @tab="\t"        @url_brace=SiSU_Viz::Skin.new.url_decoration        # lots introduced to do html tables in db        @@tablehead,@@tablefoot=[],[]        @vz=SiSU_Env::Get_init.instance.skin +      @env=SiSU_Env::Info_env.new(@md.fns) +      @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"      end      def urls(data)        @words=[] @@ -128,11 +139,11 @@ module SiSU_Format_Shared      def paragraph        %{#{@tab*1}<p class="h#@lv" id="#@ocn" type="substantive" header="#@hname">\n#{@tab*2}#@content\n#{@tab*1}</p>\n}  << "\n"      end -    def endnote +    def endnote #used only by db        @content=markup(@content)        <<GSUB  #{@tab*1}<p class="endnote" name="note_#@notenumber" from="#@ocn"> -#{@tab*2}<a name="_#@notenumber" href="#-#@notenumber">#@notenumber.</a> <note>#@content</note> +#{@tab*2}<a href="#@base_url#-#@notenumber" name="_#@notenumber">#@notenumber.</a> <note>#@content</note>  #{@tab*1}</p>  GSUB      end diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index ddd84aaa..e9e39268 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -84,6 +84,9 @@ module SiSU_Env      def monthonly        @t.month      end +    def year_static +      '2007' +    end    end    class Info_system      require 'rbconfig' diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 4d69c1ae..72cd3932 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -64,7 +64,7 @@ module SiSU_TeX_Pdf      def initialize(md,orientation='')        @md,@orientation=md,orientation        @vz=SiSU_Env::Get_init.instance.skin -      @date=SiSU_Env::Info_date.new +      @date=SiSU_Env::Info_date.new # #{@date.year}        @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}'        #@url_brace=SiSU_Viz::Skin.new.url_decoration      end @@ -144,9 +144,9 @@ WOK  \\\\ ~  {\\begin{footnotesize}#{base_prog_txt}  \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} -\\\\ using SiSU: object citation numbering, markup, meta-markup, and system -\\\\ #@copymark Ralph Amissah 1997, current #{@date.year}, All Rights Reserved. -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, \\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}. \\\\ \\href{http://www.sisudoc.org}{www.sisudoc.org} +\\\\ #@copymark Ralph Amissah 1997, current #{@date.year_static}, All Rights Reserved. +\\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org} +\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, \\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}.  {\\end{footnotesize}  \\\\  WOK @@ -221,10 +221,10 @@ WOK  \"Support Open Standards and Software Libre for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}}  \\addcontentsline{toc}{subsection}{Information on this document copy}  {\\begin{footnotesize} -\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny}  \\href{http://www.sisudoc.org}{www.sisudoc.org} (using SiSU: object citation numbering, markup, meta-markup, and system) #@copymark Ralph Amissah 1997, current #{@date.year}, All Rights Reserved. +\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny}  \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) #@copymark Ralph Amissah 1997, current #{@date.year_static}, All Rights Reserved.  \\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize}  {\\begin{small} -\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title} \\textbf{pdf} versions can be found at:  \\\\ +\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title} \\textbf{pdf} versions can be found at:  \\\\  {\\end{small}  \\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}  \\\\  \\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}  \\\\ | 
