sisu 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
data/lib/sisu/cgi.rb
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** generates naive cgi search form for search of sisu database (pgsql sqlite)
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_CGI #% database building documents
|
|
58
|
+
require_relative 'se' # se.rb
|
|
59
|
+
require_relative 'cgi_pgsql' # cgi_pgsql.rb
|
|
60
|
+
require_relative 'cgi_sqlite' # cgi_sqlite.rb
|
|
61
|
+
class SearchSQL
|
|
62
|
+
def initialize(opt)
|
|
63
|
+
@opt=opt
|
|
64
|
+
@webserv=@opt.files[0].to_s.strip
|
|
65
|
+
end
|
|
66
|
+
def read
|
|
67
|
+
if @opt.act[:sample_search_form][:db]==:pg # cgi_pgsql.rb
|
|
68
|
+
SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql
|
|
69
|
+
elsif @opt.act[:sample_search_form][:db]==:sqlite # cgi_sqlite.rb
|
|
70
|
+
SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite
|
|
71
|
+
else
|
|
72
|
+
puts <<-WOK
|
|
73
|
+
please select database type for which sample search form should be built (pgsql or sqlite)
|
|
74
|
+
sisu --sample-search-form --db=sqlite
|
|
75
|
+
sisu --sample-search-form --db=pg
|
|
76
|
+
other options include
|
|
77
|
+
--webserv-cgi='[cgi-server-name]'
|
|
78
|
+
--webserv-output='[sisu-output-server-with-base-path]'
|
|
79
|
+
WOK
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
__END__
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** generates naive cgi search form for search of sisu database (pgsql)
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi_pgsql.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_CGI_PgSQL #% database building documents
|
|
58
|
+
require_relative 'se' # se.rb
|
|
59
|
+
require_relative 'cgi_sql_common' # cgi_sql_common.rb
|
|
60
|
+
include SiSU_CGI_SQL
|
|
61
|
+
class SearchPgSQL < CGI_Common
|
|
62
|
+
def initialize(opt,webserv)
|
|
63
|
+
@opt,@webserv=opt,webserv
|
|
64
|
+
@cX=SiSU_Screen::Ansi.new(opt.act[:color_state][:set]).cX
|
|
65
|
+
@env=SiSU_Env::InfoEnv.new('',opt)
|
|
66
|
+
@sys=SiSU_Env::SystemCall.new
|
|
67
|
+
@db=SiSU_Env::InfoDb.new
|
|
68
|
+
get_init=SiSU_Env::GetInit.new
|
|
69
|
+
@rc=get_init.sisu_yaml.rc
|
|
70
|
+
@name_of={}
|
|
71
|
+
@name_of[:output_dir_structure]=if opt.dir_structure_by.to_s =~/(?:language|filetype|filename)/
|
|
72
|
+
opt.dir_structure_by.to_s
|
|
73
|
+
else 'language'
|
|
74
|
+
end
|
|
75
|
+
@name_of[:lingual]=if opt.lingual.to_s =~/(?:mono|multi)/
|
|
76
|
+
opt.lingual.to_s
|
|
77
|
+
else 'multi'
|
|
78
|
+
end
|
|
79
|
+
@name_of[:db]=if defined? @rc['search'] \
|
|
80
|
+
and defined? @rc['search']['sisu'] \
|
|
81
|
+
and defined? @rc['search']['sisu']['action'] \
|
|
82
|
+
and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ \
|
|
83
|
+
and defined? @rc['search']['sisu']['db'] \
|
|
84
|
+
and @rc['search']['sisu']['db'] =~/\S+/
|
|
85
|
+
@rc['search']['sisu']['db']
|
|
86
|
+
else
|
|
87
|
+
@env.path.base_markup_dir_stub #'sisu' #breaks if not present
|
|
88
|
+
end
|
|
89
|
+
@name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}}
|
|
90
|
+
@name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}}
|
|
91
|
+
@name_of[:cgi_script]=%q{#{ENV['SCRIPT_NAME']}}
|
|
92
|
+
@name_of[:user]=@db.psql.user(opt)
|
|
93
|
+
@image_src=%q{http://#{ENV['HTTP_HOST']}/_sisu/image_sys}
|
|
94
|
+
@common=SiSU_CGI_SQL::CGI_Common.new(@webserv,opt,@image_src,@env)
|
|
95
|
+
@cgi_file_name=@env.url.cgi_sample_search_form_name(opt)
|
|
96
|
+
end
|
|
97
|
+
def pgsql
|
|
98
|
+
serve=[]
|
|
99
|
+
if @sys.psql
|
|
100
|
+
available_db_table=`psql --list` # system call requires psql
|
|
101
|
+
available_db=available_db_table.scan(/(#{Db[:name_prefix]}\S+)/) if not available_db_table.nil?
|
|
102
|
+
if available_db \
|
|
103
|
+
and available_db.is_a?(Array)
|
|
104
|
+
available_db.flatten.each do |x|
|
|
105
|
+
serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1')
|
|
106
|
+
end
|
|
107
|
+
else STDERR.puts "WARNING: no postgresql database available, (have you created one?)"
|
|
108
|
+
end
|
|
109
|
+
serve=serve.sort
|
|
110
|
+
f1,f2='',''
|
|
111
|
+
serve.each do |x|
|
|
112
|
+
f1 << %{ <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
f2 << %q{ selected_db=%{<option value="#{@db_name_prefix}#{@stub}">#{@stub}</option>}} + "\n"
|
|
116
|
+
if FileTest.writable?('.')
|
|
117
|
+
output=File.open(@cgi_file_name,'w')
|
|
118
|
+
output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3
|
|
119
|
+
puts <<-WOK
|
|
120
|
+
generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off}
|
|
121
|
+
default database name: #{@cX.green}#{Db[:name_prefix]}#{@name_of[:db]}#{@cX.off} (#{@name_of[:db]})
|
|
122
|
+
db user: #{@cX.green}#{@name_of[:user]}#{@cX.off}
|
|
123
|
+
to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@name_of[:user]}'#{@cX.off}
|
|
124
|
+
|
|
125
|
+
#{@cX.fuchsia}BASED ON ALREADY EXISTING databases#{@cX.off} (default database name: #{@db.psql.db})
|
|
126
|
+
NOTE it is first necessary to createdb,
|
|
127
|
+
use sisu to create the tables & populate the postgresql db
|
|
128
|
+
|
|
129
|
+
the database to be used for this directory (#{@db.psql.db})
|
|
130
|
+
will have to be created manually if it does not exist:
|
|
131
|
+
using postgresql tools directly (the following may work):
|
|
132
|
+
(i) if you are not yet a postgresql user,
|
|
133
|
+
#{@cX.brown}sudo su postgres
|
|
134
|
+
createuser -d -a #{@env.user}
|
|
135
|
+
exit#{@cX.off}
|
|
136
|
+
(ii) create the database:
|
|
137
|
+
#{@cX.brown}createdb #{@db.psql.db}#{@cX.off}
|
|
138
|
+
[for a list of existing databases try 'psql --list']"
|
|
139
|
+
|
|
140
|
+
you can use sisu to create the database tables and populate the database with documents
|
|
141
|
+
|
|
142
|
+
sisu --pg --dropall # removes existing postgresql db & tables
|
|
143
|
+
sisu --pg --createall -v # creates postgresql db & tables
|
|
144
|
+
sisu --pg --update -v *.sst *.ssm # populate the db
|
|
145
|
+
sisu --sample-search-form --db-pg # creates the postgresql search form
|
|
146
|
+
# this should be done after creating the db
|
|
147
|
+
# to be searched
|
|
148
|
+
sisu --webrick & # starts ruby webrick web server
|
|
149
|
+
|
|
150
|
+
# if necessary make the directory '/usr/lib/cgi-bin'
|
|
151
|
+
# here we copy the postgresql search form to cgi-bin
|
|
152
|
+
# (copy #{@cgi_file_name} to your cgi directory)
|
|
153
|
+
# set file permissions to 755
|
|
154
|
+
WOK
|
|
155
|
+
a=case @webserv
|
|
156
|
+
when /pwd/ then ''
|
|
157
|
+
else <<-WOK
|
|
158
|
+
|
|
159
|
+
sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\
|
|
160
|
+
sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name}
|
|
161
|
+
WOK
|
|
162
|
+
end
|
|
163
|
+
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],a).warn
|
|
164
|
+
a=<<-WOK
|
|
165
|
+
#{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name}
|
|
166
|
+
WOK
|
|
167
|
+
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],a).print_blue
|
|
168
|
+
a="\n\t(to create and populate postgresql database see 'man sisu' and in particular the --pg option)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tusing postgresql tools directly: 'createdb #{@db.psql.db}' for a list of existing databases try 'psql --list']"
|
|
169
|
+
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],a).txt_grey
|
|
170
|
+
else puts 'failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?'
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
def header0
|
|
174
|
+
<<-WOK_SQL
|
|
175
|
+
#!/usr/bin/env ruby
|
|
176
|
+
=begin
|
|
177
|
+
#{about}
|
|
178
|
+
* Description: generates naive cgi search form for search of sisu database (pgsql)
|
|
179
|
+
#{gpl}
|
|
180
|
+
=end
|
|
181
|
+
begin
|
|
182
|
+
require 'cgi'
|
|
183
|
+
require 'fcgi'
|
|
184
|
+
require 'pg'
|
|
185
|
+
rescue LoadError
|
|
186
|
+
puts 'cgi, fcgi or pg NOT FOUND (LoadError)'
|
|
187
|
+
end
|
|
188
|
+
@stub_default='#{@name_of[:db]}'
|
|
189
|
+
@image_src="#{@image_src}"
|
|
190
|
+
@hosturl_cgi="#{@name_of[:host_url_cgi]}"
|
|
191
|
+
@hosturl_files="#{@name_of[:host_url_docs]}"
|
|
192
|
+
@output_dir_structure_by='#{@name_of[:output_dir_structure]}'
|
|
193
|
+
@lingual='#{@name_of[:lingual]}'
|
|
194
|
+
@port='#{@db.psql.port}'
|
|
195
|
+
@db_name_prefix='#{Db[:name_prefix]}'
|
|
196
|
+
@user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}'
|
|
197
|
+
@base="#{@name_of[:host_url_cgi]}#{@name_of[:cgi_script]}"
|
|
198
|
+
WOK_SQL
|
|
199
|
+
end
|
|
200
|
+
def search_statement
|
|
201
|
+
<<-'WOK_SQL'
|
|
202
|
+
class DBI_SearchString
|
|
203
|
+
def initialize(l,t,q,cse=false)
|
|
204
|
+
@l,@t,@q,@c=l,t,q,cse
|
|
205
|
+
end
|
|
206
|
+
def string
|
|
207
|
+
search={ search: [], flag: false }
|
|
208
|
+
if @t =~/\S+/ or @q =~/\S+/
|
|
209
|
+
if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
|
|
210
|
+
elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
|
|
211
|
+
end
|
|
212
|
+
search_construct=[]
|
|
213
|
+
unescaped_search=if @c
|
|
214
|
+
unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '").
|
|
215
|
+
gsub(/(.+)/,"#{@l}~\( '\\1' \)")
|
|
216
|
+
else
|
|
217
|
+
unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '").
|
|
218
|
+
gsub(/(.+)/,"#{@l}~*\( '\\1' \)")
|
|
219
|
+
end
|
|
220
|
+
search_construct << unescaped_search
|
|
221
|
+
search_construct=search_construct.join(' ')
|
|
222
|
+
search[:search] << search_construct
|
|
223
|
+
search[:flag]=true
|
|
224
|
+
search
|
|
225
|
+
end
|
|
226
|
+
search
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
WOK_SQL
|
|
230
|
+
end
|
|
231
|
+
def search_query1
|
|
232
|
+
<<-'WOK_SQL'
|
|
233
|
+
@search_text=''
|
|
234
|
+
@search_text=search[:text].flatten.join(' AND ')
|
|
235
|
+
@search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
|
|
236
|
+
end
|
|
237
|
+
WOK_SQL
|
|
238
|
+
end
|
|
239
|
+
def search_query2
|
|
240
|
+
<<-'WOK_SQL'
|
|
241
|
+
def sql_select_body
|
|
242
|
+
limit ||=@@limit
|
|
243
|
+
offset ||=@@offset
|
|
244
|
+
@sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE (#{@search_text}) AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn}
|
|
245
|
+
@sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
|
|
246
|
+
select=@sql_statement[:body] + ' ' + @sql_statement[:range]
|
|
247
|
+
select
|
|
248
|
+
end
|
|
249
|
+
def sql_select_body_format
|
|
250
|
+
%{<font color="#666666" size="2">#{sql_select_body}</font>}
|
|
251
|
+
end
|
|
252
|
+
def contents
|
|
253
|
+
@conn.exec(sql_select_body)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
WOK_SQL
|
|
257
|
+
end
|
|
258
|
+
def buttons1_pgsql
|
|
259
|
+
<<-'WOK_SQL'
|
|
260
|
+
<input type="checkbox" name="casesense" #{@checked_case}> case sensitive
|
|
261
|
+
WOK_SQL
|
|
262
|
+
end
|
|
263
|
+
def dbi_connect
|
|
264
|
+
<<-'WOK_SQL'
|
|
265
|
+
@conn=PG::Connection.open(dbname: @db, port: @port, user: @user)
|
|
266
|
+
WOK_SQL
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
__END__
|
|
@@ -0,0 +1,986 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** generates naive cgi search form for search of sisu database (pgsql sqlite)
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/cgi_sql_common.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_CGI_SQL
|
|
58
|
+
class CGI_Common
|
|
59
|
+
def initialize(webserv,opt,image_src,dir)
|
|
60
|
+
@webserv,@opt,@image_src,@env=webserv,opt,image_src,dir
|
|
61
|
+
end
|
|
62
|
+
def about
|
|
63
|
+
<<-'WOK_SQL'
|
|
64
|
+
* Name: SiSU information Structuring Universe
|
|
65
|
+
* Author: Ralph Amissah
|
|
66
|
+
* http://www.jus.uio.no/sisu
|
|
67
|
+
* http://www.jus.uio.no/sisu/SiSU/download
|
|
68
|
+
WOK_SQL
|
|
69
|
+
end
|
|
70
|
+
def gpl
|
|
71
|
+
<<-'WOK_SQL'
|
|
72
|
+
* Name: SiSU generated sample cgi search form
|
|
73
|
+
|
|
74
|
+
* Description: generated sample cgi search form for SiSU
|
|
75
|
+
(SiSU is a framework for document structuring, publishing and search)
|
|
76
|
+
|
|
77
|
+
* Author: Ralph Amissah
|
|
78
|
+
|
|
79
|
+
* Copyright: (C) 1997 - 2014, Ralph Amissah, All Rights Reserved.
|
|
80
|
+
|
|
81
|
+
* License: GPL 3 or later:
|
|
82
|
+
|
|
83
|
+
SiSU, a framework for document structuring, publishing and search
|
|
84
|
+
|
|
85
|
+
Copyright (C) Ralph Amissah
|
|
86
|
+
|
|
87
|
+
This program is free software: you can redistribute it and/or modify it
|
|
88
|
+
under the terms of the GNU General Public License as published by the Free
|
|
89
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
90
|
+
any later version.
|
|
91
|
+
|
|
92
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
93
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
94
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
95
|
+
more details.
|
|
96
|
+
|
|
97
|
+
You should have received a copy of the GNU General Public License along with
|
|
98
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
99
|
+
|
|
100
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
101
|
+
available at these locations:
|
|
102
|
+
<http://www.fsf.org/licenses/gpl.html>
|
|
103
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
104
|
+
<http://www.jus.uio.no/sisu/gpl.fsf>
|
|
105
|
+
|
|
106
|
+
* SiSU uses:
|
|
107
|
+
* Standard SiSU markup syntax,
|
|
108
|
+
* Standard SiSU meta-markup syntax, and the
|
|
109
|
+
* Standard SiSU object citation numbering and system
|
|
110
|
+
|
|
111
|
+
* Hompages:
|
|
112
|
+
<http://www.jus.uio.no/sisu>
|
|
113
|
+
<http://www.sisudoc.org>
|
|
114
|
+
|
|
115
|
+
* Ralph Amissah
|
|
116
|
+
<ralph@amissah.com>
|
|
117
|
+
<ralph.amissah@gmail.com>
|
|
118
|
+
WOK_SQL
|
|
119
|
+
end
|
|
120
|
+
def header1
|
|
121
|
+
<<-'WOK_SQL'
|
|
122
|
+
#Common TOP
|
|
123
|
+
@@offset=0
|
|
124
|
+
@@canned_search_url=@base
|
|
125
|
+
@color_heading='#DDFFAA'
|
|
126
|
+
@color_match='#ffff48'
|
|
127
|
+
class Form
|
|
128
|
+
def initialize(base,search_field,selected_db,result_type,checked_sql_limit,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='')
|
|
129
|
+
search_note='' if checked_searched !~/\S/
|
|
130
|
+
the_can='' if checked_url !~/\S/
|
|
131
|
+
search_field='' if checked_echo !~/\S/
|
|
132
|
+
@base,@search_field,@selected_db,@result_type,@checked_sql_limit,@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,result_type,checked_sql_limit,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
|
|
133
|
+
@tip=if checked_tip =~/\S/
|
|
134
|
+
'<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br>'
|
|
135
|
+
else ''
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
def submission_form
|
|
139
|
+
search_form=<<-WOK
|
|
140
|
+
WOK_SQL
|
|
141
|
+
end
|
|
142
|
+
def header_desc
|
|
143
|
+
<<-WOK_SQL
|
|
144
|
+
<!DOCTYPE html>
|
|
145
|
+
<html>
|
|
146
|
+
<head>
|
|
147
|
+
<title>
|
|
148
|
+
<meta charset="utf-8">
|
|
149
|
+
<meta name="sourcefile" content="SiSU._sst" />
|
|
150
|
+
SiSU search form (sample): SiSU information Structuring Universe
|
|
151
|
+
</title>
|
|
152
|
+
<link rel="generator" href="http://www.jus.uio.no/sisu" />
|
|
153
|
+
<link rel="shortcut icon" href="#{@image_src}/rb7.ico" />
|
|
154
|
+
<link href="../_sisu/css/html.css" rel="stylesheet">
|
|
155
|
+
</head>
|
|
156
|
+
<body lang="en" xml:lang="en">
|
|
157
|
+
<table summary="band" border="0" cellpadding="3" cellspacing="0">
|
|
158
|
+
<tr><td width="20%">
|
|
159
|
+
<table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">
|
|
160
|
+
<tr><td align="left">
|
|
161
|
+
<br><a href="http://sisudoc.org/" target="_top">
|
|
162
|
+
<b>SiSU</b>
|
|
163
|
+
</a>
|
|
164
|
+
<br><a href="http://git.sisudoc.org/" target="_top">
|
|
165
|
+
git
|
|
166
|
+
</a>
|
|
167
|
+
</td></tr>
|
|
168
|
+
</table>
|
|
169
|
+
</td>
|
|
170
|
+
<td>
|
|
171
|
+
<label for="find"><b>#{@env.sample_search_form_title(@opt.dir_structure_by)}</b></label>
|
|
172
|
+
</td></tr>
|
|
173
|
+
</table>
|
|
174
|
+
WOK_SQL
|
|
175
|
+
end
|
|
176
|
+
def header2
|
|
177
|
+
<<-'WOK_SQL'
|
|
178
|
+
<form action="#{@base}" id="Test Form" method="post">
|
|
179
|
+
<table cellpadding="2">
|
|
180
|
+
<tr><td valign=\"top\">
|
|
181
|
+
<textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#{@search_field}</textarea>
|
|
182
|
+
</td>
|
|
183
|
+
<td valign=\"top\">
|
|
184
|
+
#{@tip}
|
|
185
|
+
#{@search_note}
|
|
186
|
+
#{@the_can}
|
|
187
|
+
</td></tr></table>
|
|
188
|
+
<td valign=\"top\"><tr><td>
|
|
189
|
+
<!input type="text" id="find" name="find" value="#{@search_field}" />
|
|
190
|
+
<!input type="text" id="find" name="find" value="" />
|
|
191
|
+
<font size="2" color="#222222">
|
|
192
|
+
<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)
|
|
193
|
+
<br>
|
|
194
|
+
<select name="db" size="1">
|
|
195
|
+
#{@selected_db}
|
|
196
|
+
WOK_SQL
|
|
197
|
+
end
|
|
198
|
+
def buttons1
|
|
199
|
+
<<-'WOK_SQL'
|
|
200
|
+
</select>
|
|
201
|
+
<input type="submit" value="SiSU search" />
|
|
202
|
+
<input type="radio" name="view" value="index" #{@result_type[:index]}> index
|
|
203
|
+
<input type="radio" name="view" value="text" #{@result_type[:text]}> text / grep
|
|
204
|
+
WOK_SQL
|
|
205
|
+
end
|
|
206
|
+
def buttons2
|
|
207
|
+
<<-'WOK_SQL'
|
|
208
|
+
<br>
|
|
209
|
+
match limit:
|
|
210
|
+
<input type="radio" name="sql_match_limit" value="1000" #{@checked_sql_limit[:l1000]}> 1,000
|
|
211
|
+
<input type="radio" name="sql_match_limit" value="2500" #{@checked_sql_limit[:l2500]}> 2,500
|
|
212
|
+
<br>
|
|
213
|
+
<input type="checkbox" name="echo" #{@checked_echo}> echo query
|
|
214
|
+
<input type="checkbox" name="stats" #{@checked_stats}> result stats
|
|
215
|
+
<input type="checkbox" name="url" #{@checked_url}> search url
|
|
216
|
+
<input type="checkbox" name="searched" #{@checked_searched}> searched
|
|
217
|
+
<input type="checkbox" name="tip" #{@checked_tip}> available fields
|
|
218
|
+
<input type="checkbox" name="sql" #{@checked_sql}> sql statement
|
|
219
|
+
<br>
|
|
220
|
+
checks:
|
|
221
|
+
<input type="radio" name="checks" value="check_default" #{@checked_default}> default
|
|
222
|
+
<input type="radio" name="checks" value="check_selected" #{@checked_selected}> selected
|
|
223
|
+
<input type="radio" name="checks" value="check_all" #{@checked_all}> all
|
|
224
|
+
<input type="radio" name="checks" value="check_none" #{@checked_none}> none
|
|
225
|
+
</font>
|
|
226
|
+
</td></tr>
|
|
227
|
+
</table>
|
|
228
|
+
</form>
|
|
229
|
+
WOK
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
WOK_SQL
|
|
233
|
+
end
|
|
234
|
+
def search_request
|
|
235
|
+
<<-'WOK_SQL'
|
|
236
|
+
class SearchRequest #% search_for
|
|
237
|
+
attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename
|
|
238
|
+
def initialize(search_field='',q='')
|
|
239
|
+
@search_field,@q=search_field,q
|
|
240
|
+
@text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@editor=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename=''
|
|
241
|
+
if @search_field=~/\S/
|
|
242
|
+
@text1=text_to_match('text:')
|
|
243
|
+
@fulltext=text_to_match('fulltxt:')
|
|
244
|
+
@topic_register=text_to_match('topic_register:')
|
|
245
|
+
@title=text_to_match('title:') # DublinCore 1 - title
|
|
246
|
+
@author=text_to_match('(?:author|creator)s?:') # DublinCore 2 - creator/author
|
|
247
|
+
@subject=text_to_match('subj(?:ect)?:') # DublinCore 3 - subject
|
|
248
|
+
@description=text_to_match('description:') # DublinCore 4 - description
|
|
249
|
+
@publisher=text_to_match('pub(?:lisher)?:') # DublinCore 5 - publisher
|
|
250
|
+
@editor=text_to_match('editor:')
|
|
251
|
+
@contributor=text_to_match('contributor:') # DublinCore 6 - contributor
|
|
252
|
+
@date=text_to_match('date:') # DublinCore 7 - date dd-mm-yy
|
|
253
|
+
@type=text_to_match('type:') # DublinCore 8 - type
|
|
254
|
+
@format=text_to_match('format:') # DublinCore 9 - format
|
|
255
|
+
@identifier=text_to_match('identifier:') # DublinCore 10 - identifier
|
|
256
|
+
@source=text_to_match('source:') # DublinCore 11 - source
|
|
257
|
+
@language=text_to_match('language:') # DublinCore 12 - language
|
|
258
|
+
@relation=text_to_match('relation:') # DublinCore 13 - relation
|
|
259
|
+
@coverage=text_to_match('coverage:') # DublinCore 14 - coverage
|
|
260
|
+
@rights=text_to_match('rights:') # DublinCore 15 - rights
|
|
261
|
+
@keywords=text_to_match('key(?:words?)?:')
|
|
262
|
+
@comment=text_to_match('comment:')
|
|
263
|
+
@abstract=text_to_match('abs(?:tract)?:')
|
|
264
|
+
@owner=text_to_match('owner:')
|
|
265
|
+
@date_created=text_to_match('date_created:')
|
|
266
|
+
@date_issued=text_to_match('date_issued:')
|
|
267
|
+
@date_modified=text_to_match('date_modified:')
|
|
268
|
+
@date_available=text_to_match('date_available:')
|
|
269
|
+
@date_valid=text_to_match('date_valid:')
|
|
270
|
+
@filename=text_to_match('filename:')
|
|
271
|
+
@text1=text_to_match unless @keywords or @author or @title or @text1 or @fulltext or @comment or @abstract or @rights or @subject or @publisher or @date or @filename or @topic_register
|
|
272
|
+
else
|
|
273
|
+
@text1=q['s1'] if q['s1']=~/\S/
|
|
274
|
+
@fulltext=q['ft'] if q['ft']=~/\S/
|
|
275
|
+
@keywords=q['key'] if q['key']=~/\S/
|
|
276
|
+
@title=q['ti'] if q['ti']=~/\S/
|
|
277
|
+
@author=q['au'] if q['au']=~/\S/
|
|
278
|
+
@topic_register=q['tr'] if q['tr']=~/\S/
|
|
279
|
+
@subject=q['sj'] if q['sj']=~/\S/
|
|
280
|
+
@description=q['dsc'] if q['dsc']=~/\S/
|
|
281
|
+
@publisher=q['pb'] if q['pb']=~/\S/
|
|
282
|
+
@editor=q['cntr'] if q['cntr']=~/\S/
|
|
283
|
+
@contributor=q['cntr'] if q['cntr']=~/\S/
|
|
284
|
+
@date=q['dt'] if q['dt']=~/\S/
|
|
285
|
+
@type=q['ty'] if q['ty']=~/\S/
|
|
286
|
+
@identifier=q['id'] if q['id']=~/\S/
|
|
287
|
+
@source=q['src'] if q['src']=~/\S/
|
|
288
|
+
@language=q['lang'] if q['lang']=~/\S/
|
|
289
|
+
@relation=q['rel'] if q['rel']=~/\S/
|
|
290
|
+
@coverage=q['cov'] if q['cov']=~/\S/
|
|
291
|
+
@rights=q['cr'] if q['cr']=~/\S/
|
|
292
|
+
@comment=q['co'] if q['co']=~/\S/
|
|
293
|
+
@abstract=q['ab'] if q['ab']=~/\S/
|
|
294
|
+
@date_created=q['dtc'] if q['dtc']=~/\S/
|
|
295
|
+
@date_issued=q['dti'] if q['dti']=~/\S/
|
|
296
|
+
@date_modified=q['dtm'] if q['dtm']=~/\S/
|
|
297
|
+
@date_available=q['dta'] if q['dta']=~/\S/
|
|
298
|
+
@date_valid=q['dtv'] if q['dtv']=~/\S/
|
|
299
|
+
@filename=if q['doc'] and q['search'] !~/search db/ then q['doc']
|
|
300
|
+
elsif q['fns']=~/\S/ then q['fns']
|
|
301
|
+
end
|
|
302
|
+
@@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000
|
|
303
|
+
@@offset=q['off'] if q['off']=~/\d+/ # 0
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
def text_to_match(identifier='')
|
|
307
|
+
m={
|
|
308
|
+
string: /#{identifier}\s*(.+?)/,
|
|
309
|
+
string: /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
|
|
310
|
+
word: /#{identifier}[\s(]*(\S+)/
|
|
311
|
+
}
|
|
312
|
+
search_string=if @search_field =~m[:word]
|
|
313
|
+
search_string=if @search_field =~m[:braces] then m[:braces].match(@search_field)[1]
|
|
314
|
+
elsif @search_field =~m[:string] then m[:string].match(@search_field)[1]
|
|
315
|
+
else
|
|
316
|
+
str=m[:word].match(@search_field)[1]
|
|
317
|
+
str=str.gsub(/[()]/,'')
|
|
318
|
+
str
|
|
319
|
+
end
|
|
320
|
+
search_string=search_string.strip.gsub(/\s+/,'+')
|
|
321
|
+
#else
|
|
322
|
+
# "__"
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
WOK_SQL
|
|
327
|
+
end
|
|
328
|
+
def search_statement_common
|
|
329
|
+
<<-'WOK_SQL'
|
|
330
|
+
class DBI_SearchStatement
|
|
331
|
+
attr_reader :text_search_flag,:sql_select_body_format,:sql_offset,:sql_limit
|
|
332
|
+
def initialize(conn,search_for,q,c)
|
|
333
|
+
@conn=conn
|
|
334
|
+
@text_search_flag=false
|
|
335
|
+
@sql_statement={ body: '', endnotes: '', range: '' }
|
|
336
|
+
#@offset||=@@offset
|
|
337
|
+
#@offset+=@@limit
|
|
338
|
+
search={ text: [], endnotes: [] }
|
|
339
|
+
cse=(c =~/\S/) ? true : false
|
|
340
|
+
st=DBI_SearchString.new('doc_objects.clean',search_for.text1,q['s1'],cse).string
|
|
341
|
+
se=DBI_SearchString.new('endnotes.clean',search_for.text1,q['s1'],cse).string
|
|
342
|
+
@text_search_flag=st[:flag]
|
|
343
|
+
if st[:flag]
|
|
344
|
+
search[:text] << st[:search]
|
|
345
|
+
end
|
|
346
|
+
st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string
|
|
347
|
+
if st[:flag]
|
|
348
|
+
search[:text] << st[:search]
|
|
349
|
+
end
|
|
350
|
+
st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string
|
|
351
|
+
if st[:flag]
|
|
352
|
+
search[:text] << st[:search]
|
|
353
|
+
end
|
|
354
|
+
st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string
|
|
355
|
+
if st[:flag]
|
|
356
|
+
search[:text] << st[:search]
|
|
357
|
+
end
|
|
358
|
+
st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string
|
|
359
|
+
if st[:flag]
|
|
360
|
+
search[:text] << st[:search]
|
|
361
|
+
end
|
|
362
|
+
st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string
|
|
363
|
+
if st[:flag]
|
|
364
|
+
search[:text] << st[:search]
|
|
365
|
+
end
|
|
366
|
+
st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string
|
|
367
|
+
if st[:flag]
|
|
368
|
+
search[:text] << st[:search]
|
|
369
|
+
end
|
|
370
|
+
st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string
|
|
371
|
+
if st[:flag]
|
|
372
|
+
search[:text] << st[:search]
|
|
373
|
+
end
|
|
374
|
+
st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string
|
|
375
|
+
if st[:flag]
|
|
376
|
+
search[:text] << st[:search]
|
|
377
|
+
end
|
|
378
|
+
st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string
|
|
379
|
+
if st[:flag]
|
|
380
|
+
search[:text] << st[:search]
|
|
381
|
+
end
|
|
382
|
+
st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string
|
|
383
|
+
if st[:flag]
|
|
384
|
+
search[:text] << st[:search]
|
|
385
|
+
end
|
|
386
|
+
st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string
|
|
387
|
+
if st[:flag]
|
|
388
|
+
search[:text] << st[:search]
|
|
389
|
+
end
|
|
390
|
+
st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string
|
|
391
|
+
if st[:flag]
|
|
392
|
+
search[:text] << st[:search]
|
|
393
|
+
end
|
|
394
|
+
st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string
|
|
395
|
+
if st[:flag]
|
|
396
|
+
search[:text] << st[:search]
|
|
397
|
+
end
|
|
398
|
+
st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string
|
|
399
|
+
if st[:flag]
|
|
400
|
+
search[:text] << st[:search]
|
|
401
|
+
end
|
|
402
|
+
st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string
|
|
403
|
+
if st[:flag]
|
|
404
|
+
search[:text] << st[:search]
|
|
405
|
+
end
|
|
406
|
+
st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string
|
|
407
|
+
if st[:flag]
|
|
408
|
+
search[:text] << st[:search]
|
|
409
|
+
end
|
|
410
|
+
st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string
|
|
411
|
+
if st[:flag]
|
|
412
|
+
search[:text] << st[:search]
|
|
413
|
+
end
|
|
414
|
+
st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string
|
|
415
|
+
if st[:flag]
|
|
416
|
+
search[:text] << st[:search]
|
|
417
|
+
end
|
|
418
|
+
st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string
|
|
419
|
+
if st[:flag]
|
|
420
|
+
search[:text] << st[:search]
|
|
421
|
+
end
|
|
422
|
+
st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
|
|
423
|
+
if st[:flag]
|
|
424
|
+
search[:text] << st[:search]
|
|
425
|
+
end
|
|
426
|
+
@@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000
|
|
427
|
+
@@offset=q['off'] if q['off']=~/\d+/ # 0
|
|
428
|
+
WOK_SQL
|
|
429
|
+
end
|
|
430
|
+
def pages
|
|
431
|
+
<<-'WOK_SQL'
|
|
432
|
+
def sql_offset
|
|
433
|
+
@@offset
|
|
434
|
+
end
|
|
435
|
+
def sql_match_limit
|
|
436
|
+
@@limit
|
|
437
|
+
end
|
|
438
|
+
def sql_canned_search
|
|
439
|
+
@offset_next=sql_offset.to_i + sql_match_limit.to_i
|
|
440
|
+
@offset_previous=sql_offset.to_i - sql_match_limit.to_i
|
|
441
|
+
def current
|
|
442
|
+
@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + sql_offset.to_s
|
|
443
|
+
end
|
|
444
|
+
def next
|
|
445
|
+
@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_next.to_s
|
|
446
|
+
end
|
|
447
|
+
def previous
|
|
448
|
+
@offset_previous >= 0 \
|
|
449
|
+
? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s)
|
|
450
|
+
: ''
|
|
451
|
+
end
|
|
452
|
+
def start
|
|
453
|
+
@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + 0.to_s
|
|
454
|
+
end
|
|
455
|
+
self
|
|
456
|
+
end
|
|
457
|
+
def pre_next(beyond_limit,img)
|
|
458
|
+
can=sql_canned_search
|
|
459
|
+
page=(sql_offset.to_i + sql_match_limit.to_i)/sql_match_limit.to_i
|
|
460
|
+
if beyond_limit
|
|
461
|
+
if page.to_s =~ /^1$/
|
|
462
|
+
%{<br><center>
|
|
463
|
+
pg. #{page.to_s}
|
|
464
|
+
<a href="#{can.next}">
|
|
465
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" />
|
|
466
|
+
</a>
|
|
467
|
+
</center>}
|
|
468
|
+
elsif page.to_s =~ /^2$/
|
|
469
|
+
%{<br><center>
|
|
470
|
+
<a href="#{can.previous}">
|
|
471
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " />
|
|
472
|
+
</a>
|
|
473
|
+
pg. #{page.to_s}
|
|
474
|
+
<a href="#{can.next}">
|
|
475
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" />
|
|
476
|
+
</a>
|
|
477
|
+
</center>}
|
|
478
|
+
else
|
|
479
|
+
%{<br><center>
|
|
480
|
+
<a href="#{can.start}">
|
|
481
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " />
|
|
482
|
+
</a>
|
|
483
|
+
<a href="#{can.previous}">
|
|
484
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " />
|
|
485
|
+
</a>
|
|
486
|
+
pg. #{page.to_s}
|
|
487
|
+
<a href="#{can.next}">
|
|
488
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" />
|
|
489
|
+
</a>
|
|
490
|
+
</center>}
|
|
491
|
+
end
|
|
492
|
+
else
|
|
493
|
+
if page.to_s =~ /^1$/ then ''
|
|
494
|
+
elsif page.to_s =~ /^2$/
|
|
495
|
+
%{<br><center>
|
|
496
|
+
<a href="#{can.previous}">
|
|
497
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " />
|
|
498
|
+
</a>
|
|
499
|
+
pg. #{page.to_s}
|
|
500
|
+
</center>}
|
|
501
|
+
else
|
|
502
|
+
%{<br><center>
|
|
503
|
+
<a href="#{can.start}">
|
|
504
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " />
|
|
505
|
+
</a>
|
|
506
|
+
<a href="#{can.previous}">
|
|
507
|
+
<img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " />
|
|
508
|
+
</a>
|
|
509
|
+
pg. #{page.to_s}
|
|
510
|
+
</center>}
|
|
511
|
+
end
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
WOK_SQL
|
|
515
|
+
end
|
|
516
|
+
def tail
|
|
517
|
+
v=SiSU_Env::InfoVersion.instance.get_version
|
|
518
|
+
<<-WOK_SQL
|
|
519
|
+
def tail
|
|
520
|
+
<<-'WOK'
|
|
521
|
+
<br><hr /><br>
|
|
522
|
+
<table summary="SiSU summary" cellpadding="2" border="0">
|
|
523
|
+
<!-- widget sisu -->
|
|
524
|
+
<tr><td valign="top" width="10%">
|
|
525
|
+
<table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">
|
|
526
|
+
<tr><td align="left">
|
|
527
|
+
<br><a href="http://sisudoc.org/" target="_top">
|
|
528
|
+
<b>SiSU</b>
|
|
529
|
+
</a>
|
|
530
|
+
<br><a href="http://git.sisudoc.org/" target="_top">
|
|
531
|
+
git
|
|
532
|
+
</a>
|
|
533
|
+
</td></tr>
|
|
534
|
+
</table>
|
|
535
|
+
</td>
|
|
536
|
+
<td valign="top" width="45%">
|
|
537
|
+
<!-- SiSU Rights -->
|
|
538
|
+
<p class="tiny_left"><font color="#666666" size="2">
|
|
539
|
+
Generated by
|
|
540
|
+
#{v.project} #{v.version} #{v.date} (#{v.date_stamp})
|
|
541
|
+
<br>
|
|
542
|
+
<a href="http://www.sisudoc.org" >
|
|
543
|
+
<b>#{v.project}</b></a> <sup>©</sup> Ralph Amissah
|
|
544
|
+
1993, current 2014.
|
|
545
|
+
All Rights Reserved.
|
|
546
|
+
<br>
|
|
547
|
+
#{v.project} is software for document structuring, publishing and search,
|
|
548
|
+
<br>
|
|
549
|
+
<a href="http://www.jus.uio.no/sisu" >
|
|
550
|
+
www.jus.uio.no/sisu
|
|
551
|
+
</a>
|
|
552
|
+
and
|
|
553
|
+
<a href="http://www.sisudoc.org" >
|
|
554
|
+
www.sisudoc.org
|
|
555
|
+
</a>
|
|
556
|
+
sources
|
|
557
|
+
<a href="http://git.sisudoc.org" >
|
|
558
|
+
git.sisudoc.org
|
|
559
|
+
</a>
|
|
560
|
+
<br>
|
|
561
|
+
<i>w3 since October 3 1993</i>
|
|
562
|
+
<a href="mailto:ralph@amissah.com" >
|
|
563
|
+
ralph@amissah.com
|
|
564
|
+
</a>
|
|
565
|
+
<br>
|
|
566
|
+
mailing list subscription
|
|
567
|
+
<a href="http://lists.sisudoc.org/listinfo/sisu" >
|
|
568
|
+
http://lists.sisudoc.org/listinfo/sisu
|
|
569
|
+
</a>
|
|
570
|
+
<br>
|
|
571
|
+
<a href="mailto:sisu@lists.sisudoc.org" >
|
|
572
|
+
sisu@lists.sisudoc.org
|
|
573
|
+
</a>
|
|
574
|
+
</font></p>
|
|
575
|
+
</td><td valign="top" width="45%">
|
|
576
|
+
<p class="tiny_left"><font color="#666666" size="2">
|
|
577
|
+
#{v.project} using:
|
|
578
|
+
<br>Standard SiSU markup syntax,
|
|
579
|
+
<br>Standard SiSU meta-markup syntax, and the
|
|
580
|
+
<br>Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system)
|
|
581
|
+
<br>
|
|
582
|
+
<sup>©</sup> Ralph Amissah 1997, current 2014.
|
|
583
|
+
All Rights Reserved.
|
|
584
|
+
</font></p>
|
|
585
|
+
</td></tr>
|
|
586
|
+
<!-- widget way better -->
|
|
587
|
+
<tr><td valign="top" width="10%">
|
|
588
|
+
<p class="tiny_left"><font color="#666666" size="2">
|
|
589
|
+
<a href="http://www.gnu.org/licenses/gpl.html">
|
|
590
|
+
.:
|
|
591
|
+
</a>
|
|
592
|
+
</font></p>
|
|
593
|
+
</td><td valign="top" width="45%">
|
|
594
|
+
<p class="tiny_left"><font color="#666666" size="2">
|
|
595
|
+
SiSU is released under
|
|
596
|
+
<a href="http://www.gnu.org/licenses/gpl.html">GPL v3</a>
|
|
597
|
+
or later,
|
|
598
|
+
<a href="http://www.gnu.org/licenses/gpl.html">
|
|
599
|
+
http://www.gnu.org/licenses/gpl.html
|
|
600
|
+
</a>
|
|
601
|
+
</font></p>
|
|
602
|
+
</td><td valign="top" width="45%">
|
|
603
|
+
<p class="tiny_left"><font color="#666666" size="2">
|
|
604
|
+
#{v.project}, developed using
|
|
605
|
+
<a href="http://www.ruby-lang.org/en/">
|
|
606
|
+
Ruby
|
|
607
|
+
</a>
|
|
608
|
+
on
|
|
609
|
+
<a href="http://www.debian.org/">
|
|
610
|
+
Debian/Gnu/Linux
|
|
611
|
+
</a>
|
|
612
|
+
software infrastructure,
|
|
613
|
+
with the usual GPL (or OSS) suspects.
|
|
614
|
+
</font></p>
|
|
615
|
+
</td></tr>
|
|
616
|
+
</table>
|
|
617
|
+
<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>
|
|
618
|
+
</body></html>
|
|
619
|
+
WOK
|
|
620
|
+
end
|
|
621
|
+
WOK_SQL
|
|
622
|
+
end
|
|
623
|
+
def main1
|
|
624
|
+
<<-'WOK_SQL'
|
|
625
|
+
@tail=tail
|
|
626
|
+
@counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0
|
|
627
|
+
@counters_txt,@counters_endn,@sql_select_body='','',''
|
|
628
|
+
FCGI.each_cgi do |cgi|
|
|
629
|
+
begin # all code goes in begin section
|
|
630
|
+
@search={ text: [], endnotes: [] }
|
|
631
|
+
q=CGI.new
|
|
632
|
+
@db=if cgi['db'] =~ /#{@db_name_prefix}(\S+)/
|
|
633
|
+
@stub=$1
|
|
634
|
+
cgi['db']
|
|
635
|
+
else
|
|
636
|
+
@stub=@stub_default
|
|
637
|
+
@db_name_prefix + @stub
|
|
638
|
+
end
|
|
639
|
+
checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''
|
|
640
|
+
result_type=(cgi['view']=~/text/) \
|
|
641
|
+
? result_type={ index: '', text: 'checked'}
|
|
642
|
+
: result_type={ index: 'checked', text: ''}
|
|
643
|
+
@@limit=if cgi['sql_match_limit'].to_s=~/2500/
|
|
644
|
+
checked_sql_limit={ l1000: '', l2500: 'checked'}
|
|
645
|
+
'2500'
|
|
646
|
+
else
|
|
647
|
+
checked_sql_limit={ l1000: 'checked', l2500: ''}
|
|
648
|
+
'1000'
|
|
649
|
+
end
|
|
650
|
+
checked_echo='checked' if cgi['echo'] =~/\S/
|
|
651
|
+
checked_stats='checked' if cgi['stats'] =~/\S/
|
|
652
|
+
checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1
|
|
653
|
+
checked_searched='checked' if cgi['searched'] =~/\S/
|
|
654
|
+
checked_tip='checked' if cgi['tip'] =~/\S/
|
|
655
|
+
checked_case='checked' if cgi['casesense'] =~/\S/
|
|
656
|
+
checked_sql='checked' if cgi['sql'] =~/\S/
|
|
657
|
+
if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1
|
|
658
|
+
checked_all='checked'
|
|
659
|
+
checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked'
|
|
660
|
+
checked_none=''
|
|
661
|
+
elsif cgi['checks'] =~/check_none/
|
|
662
|
+
checked_none='checked'
|
|
663
|
+
checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql=''
|
|
664
|
+
elsif cgi['checks'] =~/check_selected/
|
|
665
|
+
checked_selected='checked'
|
|
666
|
+
elsif cgi['checks'] =~/check_default/
|
|
667
|
+
checked_default='checked'
|
|
668
|
+
checked_echo=checked_stats=checked_url='checked'
|
|
669
|
+
checked_searched=checked_tip=checked_case=checked_sql=''
|
|
670
|
+
else
|
|
671
|
+
checked_selected='checked'
|
|
672
|
+
checked_echo=checked_stats=checked_url='checked'
|
|
673
|
+
checked_searched=checked_tip=checked_case=checked_sql=''
|
|
674
|
+
end
|
|
675
|
+
WOK_SQL
|
|
676
|
+
end
|
|
677
|
+
def main2
|
|
678
|
+
<<-'WOK_SQL'
|
|
679
|
+
search_field=cgi['find'] if cgi['find'] # =~/\S+/
|
|
680
|
+
@search_for=SearchRequest.new(search_field,q) #.analyze #% search_for
|
|
681
|
+
#% searches
|
|
682
|
+
#Canned_search.new(@base,@search_for.text1,cgi)
|
|
683
|
+
if @search_for.text1=~/\S+/ or @search_for.fulltext=~/\S+/ or @search_for.author=~/\S+/ or @search_for.topic_register=~/\S+/ #and search_field =~/\S/
|
|
684
|
+
s1='s1=' + CGI.escape(@search_for.text1) if @search_for.text1=~/\S/
|
|
685
|
+
ft='&ft=' + CGI.escape(@search_for.fulltext) if @search_for.fulltext=~/\S/
|
|
686
|
+
key='key=' + CGI.escape(@search_for.keywords) if @search_for.keywords=~/\S/
|
|
687
|
+
ti='&ti=' + CGI.escape(@search_for.title) if @search_for.title=~/\S/
|
|
688
|
+
au='&au=' + CGI.escape(@search_for.author) if @search_for.author=~/\S/
|
|
689
|
+
tr='&tr=' + CGI.escape(@search_for.topic_register) if @search_for.topic_register=~/\S/
|
|
690
|
+
sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/
|
|
691
|
+
dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/
|
|
692
|
+
pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/
|
|
693
|
+
edt='&edt=' + CGI.escape(@search_for.editor) if @search_for.editor=~/\S/
|
|
694
|
+
cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/
|
|
695
|
+
dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/
|
|
696
|
+
ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/
|
|
697
|
+
id='&id=' + CGI.escape(@search_for.identifier) if @search_for.identifier=~/\S/
|
|
698
|
+
src='&src=' + CGI.escape(@search_for.source) if @search_for.source=~/\S/
|
|
699
|
+
lang='&lang=' + CGI.escape(@search_for.language) if @search_for.language=~/\S/
|
|
700
|
+
rel='&rel=' + CGI.escape(@search_for.relation) if @search_for.relation=~/\S/
|
|
701
|
+
cov='&cov=' + CGI.escape(@search_for.coverage) if @search_for.coverage=~/\S/
|
|
702
|
+
cr='&cr=' + CGI.escape(@search_for.rights) if @search_for.rights=~/\S/
|
|
703
|
+
co='&co=' + CGI.escape(@search_for.comment) if @search_for.comment=~/\S/
|
|
704
|
+
ab='&ab=' + CGI.escape(@search_for.abstract) if @search_for.abstract=~/\S/
|
|
705
|
+
dtc='&dtc=' + CGI.escape(@search_for.date_created) if @search_for.date_created=~/\S/
|
|
706
|
+
dti='&dti=' + CGI.escape(@search_for.date_issued) if @search_for.date_issued=~/\S/
|
|
707
|
+
dtm='&dtm=' + CGI.escape(@search_for.date_modified) if @search_for.date_modified=~/\S/
|
|
708
|
+
dta='&dta=' + CGI.escape(@search_for.date_available) if @search_for.date_available=~/\S/
|
|
709
|
+
dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/
|
|
710
|
+
fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/
|
|
711
|
+
@@canned_search_url=(checked_all =~/checked/) \
|
|
712
|
+
? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{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"
|
|
713
|
+
: "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}"
|
|
714
|
+
mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1
|
|
715
|
+
@canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}"
|
|
716
|
+
if checked_case=~/\S/
|
|
717
|
+
@search[:text][1]=%{doc_objects.clean~'#{@search_for.text1}'} #s1
|
|
718
|
+
else
|
|
719
|
+
@search[:text][1]=%{doc_objects.clean~*'#{@search_for.text1}'} #s1
|
|
720
|
+
end
|
|
721
|
+
canned_note='search url:'
|
|
722
|
+
else
|
|
723
|
+
@@canned_search_url="#{@base}?db=#{@db}&view=index"
|
|
724
|
+
canned_note='search url example:'
|
|
725
|
+
end
|
|
726
|
+
if search_field =~/\S+/
|
|
727
|
+
analyze_format=search_field.gsub(/\s*\n/,'; ')
|
|
728
|
+
elsif checked_all =~/checked/ or checked_url =~/checked/
|
|
729
|
+
canned_search=@@canned_search_url.scan(/(?:s1|ft|au|ti|fns|tr)=[^&]+/)
|
|
730
|
+
af=canned_search.join('; ')
|
|
731
|
+
af=af.gsub(/s1=/,'text: ').
|
|
732
|
+
gsub(/ft=/,'fulltxt: ').
|
|
733
|
+
gsub(/au=/,'author: ').
|
|
734
|
+
gsub(/ti=/,'title: ').
|
|
735
|
+
gsub(/fns=/,'filename: ').
|
|
736
|
+
gsub(/tr=/,'topic_register: ').
|
|
737
|
+
gsub(/%2B/,' ')
|
|
738
|
+
analyze_format=af
|
|
739
|
+
st=af.split(/\s*;\s*/)
|
|
740
|
+
search_field=st.join("\n")
|
|
741
|
+
end
|
|
742
|
+
green=%{<font size="2" color="#004000">}
|
|
743
|
+
canned_search_url_txt=CGI.escapeHTML(@@canned_search_url)
|
|
744
|
+
the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br>}
|
|
745
|
+
p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_editor=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=''
|
|
746
|
+
p_filename=%{filename: #{green}#{@search_for.filename}</font><br>} if @search_for.filename =~/\S+/
|
|
747
|
+
p_text=%{text: #{green}#{@search_for.text1}</font><br>} if @search_for.text1 =~/\S+/
|
|
748
|
+
p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br>} if @search_for.fulltext =~/\S+/
|
|
749
|
+
p_title=%{title: #{green}#{@search_for.title}</font><br>} if @search_for.title =~/\S+/
|
|
750
|
+
p_author=%{author: #{green}#{@search_for.author}</font><br>} if @search_for.author =~/\S+/
|
|
751
|
+
p_editor=%{editor: #{green}#{@search_for.editor}</font><br>} if @search_for.editor=~/\S+/
|
|
752
|
+
p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br>} if @search_for.contributor =~/\S+/
|
|
753
|
+
p_date=%{date: #{green}#{@search_for.date}</font><br>} if @search_for.date =~/\S+/
|
|
754
|
+
p_rights=%{rights: #{green}#{@search_for.rights}</font><br>} if @search_for.rights =~/\S+/
|
|
755
|
+
p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}</font><br>} if @search_for.topic_register =~/\S+/
|
|
756
|
+
p_subject=%{subject: #{green}#{@search_for.subject}</font><br>} if @search_for.subject =~/\S+/
|
|
757
|
+
p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br>} if @search_for.keywords =~/\S+/
|
|
758
|
+
p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br>} if @search_for.identifier =~/\S+/
|
|
759
|
+
p_type=%{type: #{green}#{@search_for.type}</font><br>} if @search_for.type =~/\S+/
|
|
760
|
+
p_format=%{format: #{green}#{@search_for.format}</font><br>} if @search_for.format =~/\S+/
|
|
761
|
+
p_relation=%{relation: #{green}#{@search_for.relation}</font><br>} if @search_for.relation =~/\S+/
|
|
762
|
+
p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br>} if @search_for.coverage =~/\S+/
|
|
763
|
+
p_description=%{description: #{green}#{@search_for.description}</font><br>} if @search_for.description =~/\S+/
|
|
764
|
+
p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br>} if @search_for.abstract =~/\S+/
|
|
765
|
+
p_comment=%{comment: #{green}#{@search_for.comment}</font><br>} if @search_for.comment =~/\S+/
|
|
766
|
+
p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br>} if @search_for.publisher =~/\S+/
|
|
767
|
+
p_source=%{source: #{green}#{@search_for.source}</font><br>} if @search_for.source =~/\S+/
|
|
768
|
+
p_language=%{language: #{green}#{@search_for.language}</font><br>} if @search_for.language =~/\S+/
|
|
769
|
+
search_note=<<-WOK
|
|
770
|
+
<font size="2" color="#666666">
|
|
771
|
+
<b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font>
|
|
772
|
+
<b>search string:</b> "#{green}#{analyze_format}</font>"<br>
|
|
773
|
+
#{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{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}
|
|
774
|
+
</font>
|
|
775
|
+
WOK
|
|
776
|
+
#eg = %{canned search e.g.:<br> <a href="#{url}">#{url}</a><br>find: #{analyze}<br>database: #{database}}
|
|
777
|
+
#% dbi_canning
|
|
778
|
+
@header=Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,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
|
|
779
|
+
unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/
|
|
780
|
+
print "Content-type: text/html\n\n"
|
|
781
|
+
puts (@header+@tail)
|
|
782
|
+
else #% searches
|
|
783
|
+
s1=(@search_for.text1 =~/\S/) \
|
|
784
|
+
? @search_for.text1
|
|
785
|
+
: 'Unavailable'
|
|
786
|
+
if checked_case=~/\S/
|
|
787
|
+
@search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'}
|
|
788
|
+
else
|
|
789
|
+
@search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'}
|
|
790
|
+
end
|
|
791
|
+
#% dbi_request
|
|
792
|
+
dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case)
|
|
793
|
+
@text_search_flag=false
|
|
794
|
+
@text_search_flag=dbi_statement.text_search_flag
|
|
795
|
+
s_contents=dbi_statement.contents
|
|
796
|
+
@body_main=''
|
|
797
|
+
@search_regx=nil
|
|
798
|
+
oldtid=0
|
|
799
|
+
if @text_search_flag
|
|
800
|
+
if checked_sql =~/\S/
|
|
801
|
+
sql_select_body=dbi_statement.sql_select_body_format
|
|
802
|
+
else sql_select_body=''
|
|
803
|
+
end
|
|
804
|
+
@body_main << sql_select_body
|
|
805
|
+
else
|
|
806
|
+
end
|
|
807
|
+
@hostpath="#{@hosturl_files}/#{@stub}"
|
|
808
|
+
WOK_SQL
|
|
809
|
+
end
|
|
810
|
+
def dir_structure #@opt.dir_structure_by
|
|
811
|
+
<<-'WOK_SQL'
|
|
812
|
+
def path_manifest(fn,ln=nil)
|
|
813
|
+
case @output_dir_structure_by
|
|
814
|
+
when 'filename'
|
|
815
|
+
@lingual =='mono' \
|
|
816
|
+
? "#{@hostpath}/#{fn}/sisu_manifest.html"
|
|
817
|
+
: "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html"
|
|
818
|
+
when 'filetype'
|
|
819
|
+
@lingual =='mono' \
|
|
820
|
+
? "#{@hostpath}/manifest/#{fn}.html"
|
|
821
|
+
: "#{@hostpath}/manifest/#{fn}.#{ln}.html"
|
|
822
|
+
else
|
|
823
|
+
"#{@hostpath}/#{ln}/manifest/#{fn}.html"
|
|
824
|
+
end
|
|
825
|
+
end
|
|
826
|
+
def path_html_seg(fn,ln=nil)
|
|
827
|
+
case @output_dir_structure_by
|
|
828
|
+
when 'filename'
|
|
829
|
+
"#{@hostpath}/#{fn}"
|
|
830
|
+
when 'filetype'
|
|
831
|
+
"#{@hostpath}/html/#{fn}"
|
|
832
|
+
else
|
|
833
|
+
"#{@hostpath}/#{ln}/html/#{fn}"
|
|
834
|
+
end
|
|
835
|
+
end
|
|
836
|
+
def path_toc(fn,ln=nil)
|
|
837
|
+
if @output_dir_structure_by =='filename' \
|
|
838
|
+
or @output_dir_structure_by =='filetype'
|
|
839
|
+
@lingual =='mono' \
|
|
840
|
+
? "#{path_html_seg(fn,ln)}/toc.html"
|
|
841
|
+
: "#{path_html_seg(fn,ln)}/toc.#{ln}.html"
|
|
842
|
+
else
|
|
843
|
+
"#{path_html_seg(fn,ln)}/toc.html"
|
|
844
|
+
end
|
|
845
|
+
end
|
|
846
|
+
def path_filename(fn,seg,ln=nil)
|
|
847
|
+
if @output_dir_structure_by =='filename' \
|
|
848
|
+
or @output_dir_structure_by =='filetype'
|
|
849
|
+
@lingual =='mono' \
|
|
850
|
+
? "#{path_html_seg(fn,ln)}/#{seg}.html"
|
|
851
|
+
: "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html"
|
|
852
|
+
else
|
|
853
|
+
"#{path_html_seg(fn,ln)}/#{seg}.html"
|
|
854
|
+
end
|
|
855
|
+
end
|
|
856
|
+
def path_html_doc(fn,ln=nil)
|
|
857
|
+
case @output_dir_structure_by
|
|
858
|
+
when 'filename'
|
|
859
|
+
@lingual =='mono' \
|
|
860
|
+
? "#{path_html_seg(fn,ln)}/scroll.html"
|
|
861
|
+
: "#{path_html_seg(fn,ln)}/scroll.#{ln}.html"
|
|
862
|
+
when 'filetype'
|
|
863
|
+
@lingual =='mono' \
|
|
864
|
+
? "#{@hostpath}/html/#{fn}.html"
|
|
865
|
+
: "#{@hostpath}/html/#{fn}.#{ln}.html"
|
|
866
|
+
else
|
|
867
|
+
"#{@hostpath}/#{ln}/html/#{fn}.html"
|
|
868
|
+
end
|
|
869
|
+
end
|
|
870
|
+
WOK_SQL
|
|
871
|
+
end
|
|
872
|
+
def main3
|
|
873
|
+
<<-'WOK_SQL'
|
|
874
|
+
#% text_objects_body
|
|
875
|
+
s_contents.each do |c| #% text body
|
|
876
|
+
location=c['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
|
|
877
|
+
file_suffix=c['src_filename'][/.+?\.(ssm\.sst|sst)$/,1]
|
|
878
|
+
lang=if location =~ /\S+?~(\S\S\S?)$/
|
|
879
|
+
l=location[/\S+?~(\S\S\S?)$/,1]
|
|
880
|
+
location=location.gsub(/(\S+?)~\S\S\S?/,'\1')
|
|
881
|
+
l=".#{l}"
|
|
882
|
+
else ''
|
|
883
|
+
end
|
|
884
|
+
#% metadata_found_body
|
|
885
|
+
if c['tid'].to_i != oldtid.to_i
|
|
886
|
+
ti=c['title']
|
|
887
|
+
can_txt_srch=(cgi['view']=~/index/) \
|
|
888
|
+
? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> }
|
|
889
|
+
: %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> }
|
|
890
|
+
title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br>} if file_suffix=~/s/ #hmm watch file_suffix
|
|
891
|
+
title=@text_search_flag \
|
|
892
|
+
? '<br><hr>'+title
|
|
893
|
+
: '<br>'+title
|
|
894
|
+
@counter_txt_doc+=1
|
|
895
|
+
oldtid=c['tid'].to_i
|
|
896
|
+
else title=''
|
|
897
|
+
end
|
|
898
|
+
if @text_search_flag
|
|
899
|
+
if cgi['view']=~/text/ \
|
|
900
|
+
or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt body
|
|
901
|
+
text=if c['suffix'] !~/1/ #seg
|
|
902
|
+
if @search_for.text1 =~/\S+/ \
|
|
903
|
+
or q['s1'] =~/\S+/ #% only this branch is working !!
|
|
904
|
+
unescaped_search=if @search_for.text1 =~/\S+/
|
|
905
|
+
CGI.unescape(@search_for.text1)
|
|
906
|
+
elsif q['s1'] =~/\S+/
|
|
907
|
+
CGI.unescape(q['s1'])
|
|
908
|
+
else nil
|
|
909
|
+
end
|
|
910
|
+
@search_regx=if unescaped_search #check
|
|
911
|
+
search_regex=unescaped_search.scan(/\S+/).each.map do |g|
|
|
912
|
+
(g.to_s =~/(AND|OR)/) \
|
|
913
|
+
? ('|')
|
|
914
|
+
: (%{#{g.to_s}})
|
|
915
|
+
end.join(' ')
|
|
916
|
+
search_regex=search_regex.gsub(/\s*\|\s*/,'|')
|
|
917
|
+
Regexp.new(search_regex, Regexp::IGNORECASE)
|
|
918
|
+
else nil
|
|
919
|
+
end
|
|
920
|
+
else nil
|
|
921
|
+
end
|
|
922
|
+
matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \
|
|
923
|
+
? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
|
|
924
|
+
: c['body']
|
|
925
|
+
%{<hr><p><font size="2">ocn <b><a href="#{path_filename(location,c['seg'],c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}}
|
|
926
|
+
elsif c['suffix'] =~/1/ #doc
|
|
927
|
+
%{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}}
|
|
928
|
+
end
|
|
929
|
+
@counter_txt_ocn+=1
|
|
930
|
+
output=title+text
|
|
931
|
+
else #elsif cgi['view']=~/index/ #% idx body
|
|
932
|
+
if c['suffix'] !~/1/ #seg
|
|
933
|
+
index=%{<a href="#{path_filename(location,c['seg'],c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag
|
|
934
|
+
elsif c['suffix'] =~/1/ #doc #FIX
|
|
935
|
+
index=%{<a href="#{path_html_doc(location,c['language_document_char'])}##{c['ocn']}">#{c['ocn']}</a>, }
|
|
936
|
+
end
|
|
937
|
+
if c['seg'] =~/\S+/
|
|
938
|
+
if @text_search_flag
|
|
939
|
+
@counter_txt_ocn+=1
|
|
940
|
+
output=title+index
|
|
941
|
+
end
|
|
942
|
+
else
|
|
943
|
+
@counter_txt_ocn+=1
|
|
944
|
+
output=c['suffix'] !~/1/ \
|
|
945
|
+
? title+index
|
|
946
|
+
: %{#{title}#{c['ocn'].sort}, }
|
|
947
|
+
end
|
|
948
|
+
end
|
|
949
|
+
else output=title
|
|
950
|
+
end
|
|
951
|
+
@counters_txt=if @counter_txt_doc > 0
|
|
952
|
+
if checked_stats =~/\S/
|
|
953
|
+
@@lt_t=(@counter_txt_ocn==dbi_statement.sql_match_limit.to_i) ? true : false
|
|
954
|
+
start=(@@offset.to_i+1).to_s
|
|
955
|
+
range=(@@offset.to_i+@counter_txt_ocn.to_i).to_s
|
|
956
|
+
%{<hr /><font size="2" color="#666666">Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]</font><br>}
|
|
957
|
+
else ''
|
|
958
|
+
end
|
|
959
|
+
else ''
|
|
960
|
+
end
|
|
961
|
+
@body_main << output #+ details
|
|
962
|
+
end
|
|
963
|
+
oldtid = 0
|
|
964
|
+
offset=dbi_statement.sql_offset.to_s
|
|
965
|
+
limit=dbi_statement.sql_match_limit.to_s
|
|
966
|
+
@@lt_t ||=false; @@lt_e ||=false
|
|
967
|
+
canned=(@@lt_t or @@lt_e) \
|
|
968
|
+
? dbi_statement.pre_next(true,@image_src).to_s
|
|
969
|
+
: dbi_statement.pre_next(false,@image_src).to_s
|
|
970
|
+
limit=dbi_statement.sql_match_limit.to_s
|
|
971
|
+
cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body
|
|
972
|
+
end
|
|
973
|
+
rescue Exception => e
|
|
974
|
+
s='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
|
|
975
|
+
s << CGI::escapeHTML(e.message) + '</pre>'
|
|
976
|
+
cgi.out{s}
|
|
977
|
+
next
|
|
978
|
+
ensure # eg. disconnect from server
|
|
979
|
+
@conn.disconnect if @conn
|
|
980
|
+
end
|
|
981
|
+
end
|
|
982
|
+
WOK_SQL
|
|
983
|
+
end
|
|
984
|
+
end
|
|
985
|
+
end
|
|
986
|
+
__END__
|