From 9f4d9a3118b97992eeb73845f32dbb282d4cef86 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 30 May 2013 23:09:13 -0400 Subject: v4 v5: cgi_pgsql, cgi helper script sample search form generator, detail --- data/doc/sisu/CHANGELOG_v4 | 2 ++ data/doc/sisu/CHANGELOG_v5 | 2 ++ lib/sisu/v4/cgi_pgsql.rb | 37 +++++++++++++++---------------------- lib/sisu/v5/cgi_pgsql.rb | 37 +++++++++++++++---------------------- 4 files changed, 34 insertions(+), 44 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 25dd47f9..0dcd5a39 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -32,6 +32,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.1.3.orig.tar.xz * sysenv, pgsql db connect fix +* cgi_pgsql, cgi helper script sample search form generator, detail + %% 4.1.2.orig.tar.xz (2013-05-29:21/3) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.1.2 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.1.2-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index bd49d0a1..b6b660c9 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -32,6 +32,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.3.orig.tar.xz * sysenv, pgsql db connect fix +* cgi_pgsql, cgi helper script sample search form generator, detail + %% 5.0.2.orig.tar.xz (2013-05-29:21/3) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.2 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.2-1 diff --git a/lib/sisu/v4/cgi_pgsql.rb b/lib/sisu/v4/cgi_pgsql.rb index 61c20965..0c8f42d6 100644 --- a/lib/sisu/v4/cgi_pgsql.rb +++ b/lib/sisu/v4/cgi_pgsql.rb @@ -73,11 +73,6 @@ module SiSU_CGI_PgSQL get_init=SiSU_Env::GetInit.new @rc=get_init.sisu_yaml.rc @name_of={} - if defined? @rc['webserv'] \ - and defined? @rc['webserv']['url_root'] \ - and defined? @rc['webserv']['url_root'] =~/\S+/ - @name_of[:host_url_docs]=@rc['webserv']['url_root'] - end @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ @rc['output_dir_structure_by'] @@ -90,20 +85,18 @@ module SiSU_CGI_PgSQL and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ @name_of[:db]=@rc['search']['sisu']['db'] - #@name_of[:cgi_script]=/https?:\/\/\S+?([^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] - @name_of[:host_url_cgi]=/(https?:\/\/\S+?)\/(?:[^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] else - @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:db]=@env.path.stub_pwd #'sisu' #breaks if not present - @name_of[:host_url_cgi]=@env.url.webserv_base_cgi(@opt) false end + @name_of[:host_url_cgi]="#{@env.url.webserv_base_cgi(@opt)}/cgi-bin" + @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:cgi_script]=@env.url.cgi_sample_search_form_name(@opt) + @name_of[:user]=@db.psql.user(@opt) @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" @cgi_link_name=@name_of[:cgi_script] #sisu_pgsql.cgi, @image_src="#{@env.url.webserv_base_cgi(@opt)}/_sisu/image_sys" @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) - @user=@db.psql.user(@opt) end def pgsql serve=[] @@ -130,14 +123,14 @@ module SiSU_CGI_PgSQL puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} default database name: #{@cX.green}#{Db[:name_prefix]}#{@name_of[:db]}#{@cX.off} (#{@name_of[:db]}) - db user: #{@cX.green}#{@db.psql.user(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@db.psql.user(@opt)}'#{@cX.off} - cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} - sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@env.url.webserv_files_from_db(@opt)}'#{@cX.off} - cgi search form link name: #{@cX.green}#{@env.url.cgi_sample_search_form_name(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@env.url.cgi_sample_search_form_name(@opt)}'#{@cX.off} + db user: #{@cX.green}#{@name_of[:user]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@name_of[:user]}'#{@cX.off} + cgi & db host on: #{@cX.blue}#{@name_of[:host_url_cgi]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@name_of[:host_url_cgi]}'#{@cX.off} + sisu output on: #{@cX.blue}#{@name_of[:host_url_docs]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@name_of[:host_url_docs]}'#{@cX.off} + cgi search form link name: #{@cX.green}#{@name_of[:cgi_script]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@name_of[:cgi_script]}'#{@cX.off} #{@cX.fuschia}(settings priority: command line; sisurc.yml; else defaults)#{@cX.off} #{@cX.fuschia}BASED ON ALREADY EXISTING databases#{@cX.off} (default database name: #{@db.psql.db}) @@ -206,13 +199,13 @@ module SiSU_CGI_PgSQL require 'dbi' @stub_default='#{@name_of[:db]}' @image_src='#{@image_src}' - @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' - @hosturl_files='#{@env.url.webserv_files_from_db(@opt)}' + @hosturl_cgi='#{@name_of[:host_url_cgi]}' + @hosturl_files='#{@name_of[:host_url_docs]}' @output_dir_structure_by='#{@name_of[:output_dir_structure]}' @port='#{@db.psql.port}' @db_name_prefix='#{Db[:name_prefix]}' - @user='#{@user}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' - @base='#{@name_of[:host_url_cgi]}/cgi-bin/#{@name_of[:cgi_script]}.cgi' #fix sqlite + @user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' + @base='#{@name_of[:host_url_cgi]}/#{@name_of[:cgi_script]}' WOK_SQL end def search_statement diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 45a4aae9..9ae9d191 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -73,11 +73,6 @@ module SiSU_CGI_PgSQL get_init=SiSU_Env::GetInit.new @rc=get_init.sisu_yaml.rc @name_of={} - if defined? @rc['webserv'] \ - and defined? @rc['webserv']['url_root'] \ - and defined? @rc['webserv']['url_root'] =~/\S+/ - @name_of[:host_url_docs]=@rc['webserv']['url_root'] - end @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ @rc['output_dir_structure_by'] @@ -90,20 +85,18 @@ module SiSU_CGI_PgSQL and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ @name_of[:db]=@rc['search']['sisu']['db'] - #@name_of[:cgi_script]=/https?:\/\/\S+?([^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] - @name_of[:host_url_cgi]=/(https?:\/\/\S+?)\/(?:[^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] else - @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:db]=@env.path.stub_pwd #'sisu' #breaks if not present - @name_of[:host_url_cgi]=@env.url.webserv_base_cgi(@opt) false end + @name_of[:host_url_cgi]="#{@env.url.webserv_base_cgi(@opt)}/cgi-bin" + @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:cgi_script]=@env.url.cgi_sample_search_form_name(@opt) + @name_of[:user]=@db.psql.user(@opt) @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" @cgi_link_name=@name_of[:cgi_script] #sisu_pgsql.cgi, @image_src="#{@env.url.webserv_base_cgi(@opt)}/_sisu/image_sys" @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) - @user=@db.psql.user(@opt) end def pgsql serve=[] @@ -130,14 +123,14 @@ module SiSU_CGI_PgSQL puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} default database name: #{@cX.green}#{Db[:name_prefix]}#{@name_of[:db]}#{@cX.off} (#{@name_of[:db]}) - db user: #{@cX.green}#{@db.psql.user(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@db.psql.user(@opt)}'#{@cX.off} - cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} - sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@env.url.webserv_files_from_db(@opt)}'#{@cX.off} - cgi search form link name: #{@cX.green}#{@env.url.cgi_sample_search_form_name(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@env.url.cgi_sample_search_form_name(@opt)}'#{@cX.off} + db user: #{@cX.green}#{@name_of[:user]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@name_of[:user]}'#{@cX.off} + cgi & db host on: #{@cX.blue}#{@name_of[:host_url_cgi]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@name_of[:host_url_cgi]}'#{@cX.off} + sisu output on: #{@cX.blue}#{@name_of[:host_url_docs]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@name_of[:host_url_docs]}'#{@cX.off} + cgi search form link name: #{@cX.green}#{@name_of[:cgi_script]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@name_of[:cgi_script]}'#{@cX.off} #{@cX.fuschia}(settings priority: command line; sisurc.yml; else defaults)#{@cX.off} #{@cX.fuschia}BASED ON ALREADY EXISTING databases#{@cX.off} (default database name: #{@db.psql.db}) @@ -206,13 +199,13 @@ module SiSU_CGI_PgSQL require 'dbi' @stub_default='#{@name_of[:db]}' @image_src='#{@image_src}' - @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' - @hosturl_files='#{@env.url.webserv_files_from_db(@opt)}' + @hosturl_cgi='#{@name_of[:host_url_cgi]}' + @hosturl_files='#{@name_of[:host_url_docs]}' @output_dir_structure_by='#{@name_of[:output_dir_structure]}' @port='#{@db.psql.port}' @db_name_prefix='#{Db[:name_prefix]}' - @user='#{@user}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' - @base='#{@name_of[:host_url_cgi]}/cgi-bin/#{@name_of[:cgi_script]}.cgi' #fix sqlite + @user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' + @base='#{@name_of[:host_url_cgi]}/#{@name_of[:cgi_script]}' WOK_SQL end def search_statement -- cgit v1.2.3