From e626600a6d0e5a7466f866f4663a0ebcffe2b369 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 11 Apr 2013 21:10:12 -0400 Subject: v4: cgi sample search form, minor --- lib/sisu/v4/cgi_pgsql.rb | 11 ++++++----- lib/sisu/v4/cgi_sql_common.rb | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/cgi_pgsql.rb b/lib/sisu/v4/cgi_pgsql.rb index 36f9782b..d621d187 100644 --- a/lib/sisu/v4/cgi_pgsql.rb +++ b/lib/sisu/v4/cgi_pgsql.rb @@ -77,6 +77,11 @@ module SiSU_CGI_PgSQL 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'] + else 'language' + end if defined? @rc['search'] \ and defined? @rc['search']['sisu'] \ and defined? @rc['search']['sisu']['action'] \ @@ -115,12 +120,8 @@ module SiSU_CGI_PgSQL serve.each do |x| f1 << %{ \n} unless x =~/apache|sisu\/image/ #check end - f2 << %{ selected_db=case cgi['db']\n} - serve.each do |x| - f2 << %{ when /#{Db[:name_prefix]}#{x}/; ''\n} unless x =~/apache|sisu\/image/ #check - end end - f2 << " end\n" + f2 << %q{ selected_db=%{}} + "\n" if FileTest.writable?('.') output=File.open(@cgi_file_name,'w') 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 diff --git a/lib/sisu/v4/cgi_sql_common.rb b/lib/sisu/v4/cgi_sql_common.rb index 058d04ec..f7aab470 100644 --- a/lib/sisu/v4/cgi_sql_common.rb +++ b/lib/sisu/v4/cgi_sql_common.rb @@ -650,8 +650,8 @@ module SiSU_CGI_SQL begin # all code goes in begin section @search={ text: [], endnotes: [] } q=CGI.new - @db=if cgi['db'] =~/\S+/ - @stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1] + @db=if cgi['db'] =~ /#{@db_name_prefix}(\S+)/ + @stub=$1 cgi['db'] else @stub=@stub_default -- cgit v1.2.3