From 399e6eaa0597b59b20135da362da894e09630e8b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:17:56 -0400 Subject: v3: sql db, constants, cgi-sql, structure changed, creator.editor field added --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/cgi_sql_common.rb | 23 ++++++++++++++++------- lib/sisu/v3/constants.rb | 4 ++-- lib/sisu/v3/db_columns.rb | 29 +++++++++++++++++++++++++++++ lib/sisu/v3/db_create.rb | 2 ++ lib/sisu/v3/db_load_tuple.rb | 2 ++ 6 files changed, 53 insertions(+), 9 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 47270aaa..a8a43efd 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -22,6 +22,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.14.orig.tar.gz * param, manifest, qrcode, epub, added creator.editor field + * sql db, constants, cgi-sql, structure changed, creator editor field added + * qrcode, sysenv, manifest, generate & add QR code images of metadata to manifest (using qrencode) (consider where and how else to use images) diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 8dce0743..5a2b9fde 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -138,7 +138,7 @@ module SiSU_CGI_sql search_field='' if checked_echo !~/\S/ @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 @tip=if checked_tip =~/\S/ - 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' + 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' else '' end end @@ -231,10 +231,10 @@ module SiSU_CGI_sql def search_request <<-'WOK_SQL' class Search_request #% search_for - attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,: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 + 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 def initialize(search_field='',q='') @search_field,@q=search_field,q - @text1=@fulltext=@keywords=@title=@author=@topic_register=@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='' + @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='' if @search_field=~/\S/ @text1=text_to_match('text:') @fulltext=text_to_match('fulltxt:') @@ -244,6 +244,7 @@ module SiSU_CGI_sql @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 + @editor=text_to_match('editor:') @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 @@ -275,6 +276,7 @@ module SiSU_CGI_sql @subject=q['sj'] if q['sj']=~/\S/ @description=q['dsc'] if q['dsc']=~/\S/ @publisher=q['pb'] if q['pb']=~/\S/ + @editor=q['cntr'] if q['cntr']=~/\S/ @contributor=q['cntr'] if q['cntr']=~/\S/ @date=q['dt'] if q['dt']=~/\S/ @type=q['ty'] if q['ty']=~/\S/ @@ -381,6 +383,11 @@ module SiSU_CGI_sql search[:text] << st[:search] search[:endnotes] << st[:search] end + st=Dbi_search_string.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end st=Dbi_search_string.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] @@ -709,6 +716,7 @@ module SiSU_CGI_sql 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/ + edt='&edt=' + CGI.escape(@search_for.editor) if @search_for.editor=~/\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/ @@ -727,8 +735,8 @@ module SiSU_CGI_sql 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=(checked_all =~/checked/) \ - ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{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" \ - : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{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']}" + ? "#{@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" \ + : "#{@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']}" mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" if checked_case=~/\S/ @@ -762,12 +770,13 @@ module SiSU_CGI_sql green=%{} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) the_can=%{#{canned_note} #{canned_search_url_txt}
} - p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=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='' + 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='' p_filename=%{filename: #{green}#{@search_for.filename}

} if @search_for.filename =~/\S+/ p_text=%{text: #{green}#{@search_for.text1}
} if @search_for.text1 =~/\S+/ p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}
} if @search_for.fulltext =~/\S+/ p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}
} if @search_for.editor=~/\S+/ p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ @@ -789,7 +798,7 @@ module SiSU_CGI_sql database: #{green}#{@db}; selected view: #{green}#{cgi['view']} search string: "#{green}#{analyze_format}"
- #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{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} + #{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} WOK #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index ae2a3b18..918a581f 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -151,8 +151,8 @@ Px[:lv3]= '=' Px[:lv4]= '-' Px[:lv5]= '.' Px[:lv6]= '.' -Db[:name_prefix]="SiSU#{SiSU_version_dir}d_" -Db[:name_prefix_db]="sisu_#{SiSU_version_dir}d_" +Db[:name_prefix]="SiSU#{SiSU_version_dir}e_" +Db[:name_prefix_db]="sisu_#{SiSU_version_dir}e_" Db[:col_title]=800 Db[:col_title_part]=400 Db[:col_title_edition]=10 diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb index d8a6f3cf..99118f92 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v3/db_columns.rb @@ -273,6 +273,7 @@ module SiSU_DB_columns #% creator @creator: :author: + :editor: :contributor: :illustrator: :photographer: @@ -353,6 +354,34 @@ module SiSU_DB_columns end self end + def creator_editor + def name + 'creator_editor' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document editor name(s)';} + end + def tuple + t=if defined? @md.creator.editor_detail \ + and @md.creator.editor_detail.class==Array \ + and @md.creator.editor_detail.length > 0 + txt=@md.creator.editor_detail #dc + txt='' + @md.creator.editor_detail.each do |h| + txt=txt + %{#{h[:the]}, #{h[:others]}; } + end + txt.gsub!(/[;, ]+\s*$/,'') + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end def creator_contributor # DublinCore 6 - contributor def name 'creator_contributor' diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb index 35750c4b..1804410a 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v3/db_create.rb @@ -116,6 +116,7 @@ module SiSU_DB_create #{column.creator_author.create_column} #{column.creator_author_honorific.create_column} #{column.creator_author_nationality.create_column} + #{column.creator_editor.create_column} #{column.creator_contributor.create_column} #{column.creator_illustrator.create_column} #{column.creator_photographer.create_column} @@ -375,6 +376,7 @@ module SiSU_DB_create %{#{column.creator_author.column_comment}}, %{#{column.creator_author_honorific.column_comment}}, %{#{column.creator_author_nationality.column_comment}}, + %{#{column.creator_editor.column_comment}}, %{#{column.creator_contributor.column_comment}}, %{#{column.creator_illustrator.column_comment}}, %{#{column.creator_photographer.column_comment}}, diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb index b8408f22..f7f39c08 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v3/db_load_tuple.rb @@ -132,6 +132,7 @@ module SiSU_DB_tuple #{@tp.column.creator_author.tuple[0]} #{@tp.column.creator_author_honorific.tuple[0]} #{@tp.column.creator_author_nationality.tuple[0]} +#{@tp.column.creator_editor.tuple[0]} #{@tp.column.creator_contributor.tuple[0]} #{@tp.column.creator_illustrator.tuple[0]} #{@tp.column.creator_photographer.tuple[0]} @@ -216,6 +217,7 @@ tid) #{@tp.column.creator_author.tuple[1]} #{@tp.column.creator_author_honorific.tuple[1]} #{@tp.column.creator_author_nationality.tuple[1]} +#{@tp.column.creator_editor.tuple[1]} #{@tp.column.creator_contributor.tuple[1]} #{@tp.column.creator_illustrator.tuple[1]} #{@tp.column.creator_photographer.tuple[1]} -- cgit v1.2.3